Skip to content

fix(telemetry): Keep tool results on execution spans#823

Merged
dcramer merged 4 commits into
mainfrom
codex/pr-792-followup
Jul 10, 2026
Merged

fix(telemetry): Keep tool results on execution spans#823
dcramer merged 4 commits into
mainfrom
codex/pr-792-followup

Conversation

@dcramer

@dcramer dcramer commented Jul 10, 2026

Copy link
Copy Markdown
Member

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 rawResult compatibility 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.

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>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Jul 10, 2026 4:23pm

Request Review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread packages/junior/src/chat/tool-support/pi-tool-adapter.ts
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>
@dcramer dcramer marked this pull request as ready for review July 10, 2026 16:24
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 10, 2026
@dcramer dcramer merged commit 4fa479a into main Jul 10, 2026
20 checks passed
@dcramer dcramer deleted the codex/pr-792-followup branch July 10, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant