Skip to content

fix(pi): show the trace link once the first turn is delivered - #231

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
braintrustdata:mainfrom
wolfiesch:fix/pi-trace-link-new-sessions
Oct 27, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 1 commit into
braintrustdata:mainfrom
wolfiesch:fix/pi-trace-link-new-sessions

Conversation

@wolfiesch

Copy link
Copy Markdown
Contributor

Pi refreshes the trace-link widget at session_start, before the daemon has delivered anything for a new session, so the link never shows up for that session. The daemon uploads a turn after agent_end, not during it: about a second later with flush_on_turn_end, and when its 30 second batch window closes with fire_and_forget. status.get returns before that upload, so one refresh at agent_end also misses it.

After agent_end, the extension now polls status.get every 2 seconds, for up to 40 seconds, until the current session reports a permalink. Polling stops once the link is shown, when the Pi session changes, at session_shutdown, and at the deadline. Later turns do not poll again once the link is visible. The timer is unref'd, the existing 250 ms status client is reused, and the extension still never requests a flush.

This depends on #230, which makes the daemon report permalink in status.get. Without it, the field stays null and this change has no visible effect.

Validation:

  • pnpm test in src/plugins/pi/content: 24 passed. The new polling test fails on main.
  • pnpm run check and pnpm run build in src/plugins/pi/content: pass.
  • Manual: ran the built extension in a Pi-compatible TUI against a daemon built from fix(bt-daemon): report trace permalinks in session status #230, starting a new session and sending one prompt. The link appeared about 4 seconds after the turn ended with flush_on_turn_end, and about 30 seconds after with fire_and_forget. Before this change it did not appear for the new session.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-27T06:55:06.635652Z
We couldn’t complete this review. Comment @codex review to try again.
28d8d7e PR opened
ℹ️ About Codex in GitHub

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

@wolfiesch

Copy link
Copy Markdown
Contributor Author

CI passed on my fork at this PR's head (28d8d7e): https://github.com/wolfiesch/braintrust-coding-agent-plugins/actions/runs/40469239264

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit c4115cc into braintrustdata:main Oct 27, 2026
17 checks 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.

2 participants