fix(telemetry): Keep tool results on execution spans#823
Merged
Conversation
Pass the exact span created for a tool execution through successful and failed result handling so async context changes cannot attach attributes to another span. Capture only model-facing content for content-only public results and remove the stale rawResult compatibility path. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ee2f43d. Configure here.
Pass one bound setSpanAttributes function through tool execution instead of exposing a second span method interface. Keep exact-span writes for asynchronous results and failures while using the same call shape as ambient span updates. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Use the typed Sentry span API directly instead of guarding methods that every span must implement. Keep only the valid no-active-span branch for ambient updates and use the SDK status shape. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
Delete adapter tests that mock logging solely to inspect span attributes. Telemetry is not a product behavior contract, and the remaining component and integration coverage exercises the real tool wiring without a Sentry fake. Co-Authored-By: GPT-5.6 Codex <noreply@openai.com>
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.

Tool execution telemetry now writes result and error attributes through the exact Sentry span created for the call, rather than looking up whichever span remains active after asynchronous tool work. This keeps tool inputs and outputs together even when execution changes async context.
Content-only tools expose only their model-facing content in public traces. Structured results continue to avoid duplicate JSON content, private trace projections remain unchanged, and the stale
rawResultcompatibility path is removed.The adapter suites no longer mock logging to assert span internals. Remaining component and integration coverage runs the real tool wiring and leaves telemetry verification at the instrumentation boundary.