Skip to content

fix(agent-sessions): decode tool-error payloads the way the session page does - #1148

Merged
JeremyFunk merged 3 commits into
mainfrom
fix/agent-tools-error-arguments-parity
Sep 30, 2026
Merged

JeremyFunk merged 3 commits into
mainfrom
fix/agent-tools-error-arguments-parity

fix(agent-tools): cut the payload read's attribute values in SQL

7525624
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review completed Sep 30, 2026 in 3m 7s

Confidence 3/5 · 1 issue to address

🟡 Confidence 3/5 · needs attention
The query-engine source diffs were read at the head rather than as diffs, so only their final state was verified; the three test files I read as diffs are consistent with it.
quality 90/100 · 1 warning · tests covered · risk medium · 1/1 new units observable

Warning

This review ended early; what follows is what it established.

The tool-error payload path now hands back the span's attribute map (cut, with the true sizes of the values cut) and decodes arguments/result in TypeScript through aiToolCallPayload, instead of projecting a fixed pair of attribute keys in SQL — so the modal and MCP tool read a tool span the way the session page does. The read stays org-scoped and bounded by the page's own extent, and the three test files were updated to the new row shape.

  • aiToolErrorPayloadsQuery returns spanAttributes plus cutAttributeBytes instead of arguments/result
  • aiToolErrorPayload decodes the payload with aiToolCallPayload and truncates it by codepoint
  • The payload read is bound by the page's own first and last timestamps, not the caller's window

Still open from earlier reviews

What was checked
  • Read stays org-scoped: $.OrgId.eq(param.string("orgId")) and a (TraceId, SpanId) tuple IN, no subquery (ai-tools.ts:1017)
  • aiToolErrorPayloadSlice takes min/max of the page's own timestamps, so the extent never widens (ai-tools.ts:1085)
  • truncatePayload cuts with Array.from, so a cut never splits a codepoint (ai-tools.ts:1049)
Observability coverage: 1 of 1 changes observable
Change Kind Observable Evidence
aiToolErrorPayloadsQuery — the second warehouse read of the error-samples modal database read yes runs through warehouse.compiledQuery with profile "list" and context "aiToolsErrorPayloads" (ai-session-reads.ts:740-751)

7525624 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.