Repository navigation
Use executed tool input on Claude tool spans - #199
Merged
Stephen Belanger (Qard) merged 1 commit intoOct 20, 2026
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Abhijeet Prasad (AbhiPrasad)
force-pushed
the
fix/claude-tool-span-executed-input
branch
from
October 19, 2026 22:44
4e3f26d to
7ce01eb
Compare
Claude Code PreToolUse hooks can rewrite a call's arguments via updatedInput. The tool span was created from PreToolUse.tool_input and the terminal hook's merge never replaced it, so traces could show the proposed arguments next to the output of a different executed call. The terminal merge now carries the terminal hook's tool_input and a recomputed span name when it differs from the proposed input. Fixes #156 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Abhijeet Prasad (AbhiPrasad)
force-pushed
the
fix/claude-tool-span-executed-input
branch
from
October 19, 2026 23:30
7ce01eb to
2527fd7
Compare
Stephen Belanger (Qard)
approved these changes
Oct 20, 2026
Stephen Belanger (Qard)
deleted the
fix/claude-tool-span-executed-input
branch
October 20, 2026 09:04
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.
Fixes #156.
The bug
Claude Code
PreToolUsehooks can rewrite a proposed tool call by returningupdatedInput. The terminal hook (PostToolUse,PostToolUseFailure, orPermissionDenied) reports the input the call actually ran with, or was denied with, intool_input.The Claude translator creates the tool span from
PreToolUse.tool_input. When the terminal hook arrived,finish_toolmerged in output, approval, error and metadata, but neverinputorname:The span's metadata was rebuilt from the terminal input, so the span could also disagree with itself: its
input/nameshowed the proposed call while its input-derived metadata reflected the one that ran.The fix
PendingToolnow remembers the proposed input. When the terminal hook reports a differenttool_input, the merge replaces the span'sinputand recomputes itsname:inputwhen it actually changed. An emptynameleaves the existing span name as is in the sink.tool_inputkeeps the proposed input.raw_tool_input()tells "the hook reported no input" apart from an empty one, so the{}fallback intool_input()can't overwrite the original.PermissionDenied.tool_inputis what was actually denied.raw_tool_input()is now the only place that looks up thetool_input/inputkeys;tool_input()is built on top of it.The test helper
reduce()now appliesinputandnamefrom merges (it silently dropped them before, which is how this went unnoticed). The tool-span tests also share onetool_span()lookup helper, and two overlapping hook-outcome tests are merged into one.Known limitation
Braintrust deep-merges object fields on merge. If a hook removes a key from the input, the old key stays on the span; changed values are replaced correctly. Fixing that needs
_merge_pathssupport in the sink, which the SDK'sSpanLogbuilder doesn't expose yet.🤖 Generated with Claude Code