feat(web): show processed tokens below the composer - #11450
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, self-contained composer UI addition that displays an existing processed-token value and makes a scoped CSS variable available for layout. It does not change processing behavior, product defaults, APIs, persistence, or deployment configuration. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughChatView now reads processed token usage from the active context window and displays a formatted counter below the composer. The composer stack defines the inset used when the context strip is visible, while ComposerSurface no longer defines that property. ChangesContext token display
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in this focused UI change. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
What changed
Show a compact count such as
123k tokensjust below the web and desktop composer, with a 2px gap. Align it with the send button, or with the branch name and chevron when the Local checkout strip is visible.ChatViewreads the existing normalized snapshot and reusesformatContextWindowTokens. The rendering condition is:The existing drawer inset moves to the common composer-stack wrapper so the strip and counter share it. No new state, subscriptions, dependencies, or changes to providers, contracts, persistence, or native mobile.
Why
It matters to have a persistent visual indication of how "worn-out" a thread is while deciding whether to continue in it or start fresh. Sidebar age measures elapsed time. Processed tokens measure how much usage the thread has accumulated. A young thread can already have processed millions of tokens, while an older thread may have seen very little work. These measurements complement each other, and age alone leaves that distinction invisible.
Keeping the count beside the composer makes this signal available at the moment the user writes the next prompt. It shows the latest provider-reported
totalProcessedTokens, so it is a usage signal rather than a measure of response quality or a guaranteed lifetime total. Providers that omit the total produce no counter. The display remains visible when the context-window meter is disabled.UI changes
Before:
After, aligned with the send button:
After, with Local checkout visible:
Verification
contextWindow.test.tstests passed.git diff --checkpassed. Existing lint warnings are unchanged.Checklist
Model: GPT-6. Harness: Codex.
Summary by CodeRabbit
New Features
Style