Hide stringified-undefined tool details left in already-stored sessions - #226
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 onagent_iteration/ai_callevents'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.0..n-1, every value a single character — no genuinetoolDetails/tool_definitionsrecord looks like that), not via migration.agentTracing.ts) so both the foldedtoolDetailsfield and the raw Metadata tab are clean, and again as a render-side guard in the session detail page.Test plan
npx tsc --noEmit— cleannpx eslinton touched files — cleannpx vitest run— 3237/3237 passed (2 new: hides the wreckage / leaves genuine tool details untouched)🤖 Generated with Claude Code
https://claude.ai/code/session_01R7LsJcWXZ2D9ZmhEWx1UVL