Studio: show sidebar context usage and live chat TPS - #9946
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. |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 86438e3192
βΉοΈ 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 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 address that feedback".
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 434b2e0d67
βΉοΈ 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 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 address that feedback".
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Review findings and fixesThe feature solves a real gap: Studio persisted per-message context usage but did not expose the newest saved assistant request in the sidebar, and the existing API monitor had no request-owned path to a live chat TPS value. I found and fixed these concrete defects:
The fixes are split across 13 focused commits. Verification
UI evidenceBefore: active generation without live TPSAfter: exact live TPS and cleared sidebar usage while the next request runsAfter completion: newest saved request total and cleared live TPS |
|
@codex review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d975003c58
βΉοΈ 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 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 address that feedback".
|
@codex review |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e241779899
βΉοΈ 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 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 address that feedback".
|
@codex review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 659851dcca
βΉοΈ 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 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 address that feedback".
| hasContent: summary.hasMessages, | ||
| }; | ||
| } | ||
| const legacy = await listStoredChatMessages(thread.id).catch(() => null); |
There was a problem hiding this comment.
Keep the sidebar fallback batched
When the new sidebar-summary endpoint is unavailable or returns a transient error, the fallback thread records lack hasMessages, so this branch calls listStoredChatMessages for every thread concurrently. That helper performs both getChatThread and listChatMessages, meaning an installation with hundreds of chats can issue roughly twice as many HTTP requests on every sidebar refresh; this regresses the previous fallback's single batchListChatMessages request and can overload Studio precisely while the backend is already unhealthy. Reuse a batched message read for backend threads and reserve per-thread Dexie reads for actual legacy gaps.
Useful? React with πΒ / π.
There was a problem hiding this comment.
No change: this is a compatibility-path performance concern after the summary endpoint fails, not a response correctness defect. The fallback preserves the same thread and message results, and speculative backend load does not meet the fix bar.
|
@codex review |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3cc8f9f229
βΉοΈ 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 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 address that feedback".
|
@codex review |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1ad5ca181c
βΉοΈ 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 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 address that feedback".
| onStopClick?.(); | ||
| return; | ||
| } | ||
| stopChatThread(activeThreadId); |
There was a problem hiding this comment.
Preserve cancellation before the first thread ID resolves
When generation starts on a brand-new chat before the remote thread ID has been assigned, activeThreadId is still null and the adapter deliberately stores the run under "__default". Calling stopChatThread(activeThreadId) therefore returns without dispatching anything, while the previous onStopClick cancelled the visible assistant-ui run; during this first-turn window, the Stop button does nothing. Fall back to the unresolved run key or invoke onStopClick when no active thread ID exists.
Useful? React with πΒ / π.



Summary
Shows the latest saved request token total under each chat title in the sidebar. Adds a request-scoped TPS widget to the chat header while a generation is running.
Motivation
Chat history did not expose how much context the latest request used, and live generation speed was only visible in the API monitor. Both values can now be checked from the chat surface without estimating tokens or matching an unrelated monitor row.
Changes
metadata.contextUsage.totalTokensthrough the existing batched sidebar message load. Legacy, partial, invalid, and compare rows stay unavailable instead of falling back to an older or aggregated value.X-Unsloth-Monitor-Idresponse header to row-owning chat streams and expose only that header through Studio CORS. Durable chat runs forward the same volatile correlation on their event response.How to test
The backend suite passed with 93 tests.
The focused frontend tests and both TypeScript projects passed. A broader local
npm testreused an older dependency tree and retained three unchangedremendfailures: the install has 1.3.0 while the lock pins 1.3.1. The four feature-attributable failures found by that run were fixed and their focused tests pass.Screenshots
Related
Closes #9933