perf(pi): avoid blocking tracing on streamed updates - #90
Abhijeet Prasad (AbhiPrasad) merged 2 commits into
Conversation
Forward only the first meaningful text or thinking delta for each model call, which preserves time-to-first-token data without awaiting a daemon write for every streamed token. Keep UI status polling on a short-timeout, separate client so a backed-up daemon cannot stall session startup or event capture. Also make Pi updates target the npm-qualified extension instead of a potentially shadowing local package.
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04aa905516
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| ctx.ui.setWidget(WIDGET_KEY, undefined); | ||
| } | ||
| await client.close(); | ||
| await statusClient.close(); |
There was a problem hiding this comment.
Close pending UI work before clearing shutdown state
When a fire-and-forget UI refresh from session startup, compaction, or tree navigation is still pending at shutdown, the UI is cleared before statusClient.close() waits for that request. The refreshUi continuation then resumes and restores the Braintrust: tracing status and possibly the trace-link widget after shutdown; even a timed-out status request does this because status() returns undefined and refreshUi still sets the tracing status. Await or invalidate pending status work before clearing the UI.
Useful? React with 👍 / 👎.
AI Summary
Forward only the first meaningful text or thinking delta for each model call, which preserves time-to-first-token data without awaiting a daemon write for every streamed token.
Keep UI status polling on a short-timeout, separate client so a backed-up daemon cannot stall session startup or event capture. Also make Pi updates target the npm-qualified extension instead of a potentially shadowing local package.