Skip to content

Hide stringified-undefined tool details left in already-stored sessions - #226

Merged
anilguleroglu merged 1 commit into
mainfrom
fix/spread-string-tool-details
Aug 17, 2026
Merged

Hide stringified-undefined tool details left in already-stored sessions#226
anilguleroglu merged 1 commit into
mainfrom
fix/spread-string-tool-details

Conversation

@anilguleroglu

Copy link
Copy Markdown
Collaborator

Summary

Confirmed against production data (tenant_cognipeer, post-v1.2.28): sessions captured before agent-sdk 0.9.5 have {0:'u',1:'n',...} wreckage persisted on agent_iteration/ai_call events' metadata.toolDetails — the v1.2.28 ingest guard stops new writes but does not touch what's already stored, and the UI rendered the stored shape verbatim.

  • Strips it on read (shape-matched: keys exactly 0..n-1, every value a single character — no genuine toolDetails/tool_definitions record looks like that), not via migration.
  • Applied in the API mapper (agentTracing.ts) so both the folded toolDetails field and the raw Metadata tab are clean, and again as a render-side guard in the session detail page.

Test plan

  • npx tsc --noEmit — clean
  • npx eslint on touched files — clean
  • Full suite: npx vitest run — 3237/3237 passed (2 new: hides the wreckage / leaves genuine tool details untouched)
  • Verified against live production data that the corruption is real and this shape-match catches it without false positives

🤖 Generated with Claude Code

https://claude.ai/code/session_01R7LsJcWXZ2D9ZmhEWx1UVL

agent-sdk < 0.9.5 answered an absent payload with the literal string
"undefined" (sanitizeTracePayload), and the ingest that ran before the
guard landed spread it into {0:'u',1:'n',...}. v1.2.28 stops new writes,
but every session captured in between still has that object in the
database, and the read path happily rendered it -- the Tool Details
panel showed a 9-key object of single letters, and the raw Metadata tab
showed the same thing one tab over.

Strips it on read instead of migrating: matched on shape (keys exactly
0..n-1, every value a single character), which no genuine tool-details
or tool-definitions record looks like. Applied in the API mapper (so
both the folded toolDetails field and the raw metadata bag are clean)
and again in the session-detail page as a render-side guard.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R7LsJcWXZ2D9ZmhEWx1UVL
@anilguleroglu
anilguleroglu merged commit d0ce147 into main Aug 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant