Skip to content

Context Limit Viewer#1046

Open
dbalders wants to merge 1 commit intopingdotgg:mainfrom
dbalders:context-ring
Open

Context Limit Viewer#1046
dbalders wants to merge 1 commit intopingdotgg:mainfrom
dbalders:context-ring

Conversation

@dbalders
Copy link
Contributor

@dbalders dbalders commented Mar 13, 2026

What Changed

Adds in a compact context limit view in the composer based on Codex last_token_usage.total_tokens.

  • Displays a small ring showing how much thread context is being used
  • On click, shows the actual context numbers in the same menu/popover style as the other composer controls
  • Moves into the existing ... composer controls UI when the window gets smaller

Why

Fixes #974: Displays context in a minimal way within the existing layout. It gives users a quick read on thread context usage where they are already working, and lets them click for the exact numbers.

UI Changes

Screenshot 2026-03-12 at 10 37 30 PM Screenshot 2026-03-12 at 10 37 35 PM
Screenshot 2026-03-12 at 10 30 50 PM
Screenshot 2026-03-12 at 10 31 11 PM Screenshot 2026-03-12 at 10 37 47 PM

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes

Note

Add context limit viewer to the chat composer

  • Adds a ComposerContextUsageIndicator component to the chat composer that displays a circular progress ring showing context window usage, severity (neutral/warning/danger), and an optional compaction dot with a details popup.
  • Introduces deriveThreadContextUsageSnapshot in session-logic.ts to compute normalized usage (usedTokens, maxTokens, percentUsed) and compaction recency from thread activity streams, invalidating stale usage when compaction is newer.
  • Extends the CodexAdapter to emit thread.token-usage.updated runtime events from codex/event/token_count payloads, replacing the previous thread/tokenUsage/updated handling.
  • Extends ProviderRuntimeIngestion to map thread.token-usage.updated into thread.context.usage.updated activities and thread.state.changed (compacted) into thread.context.compacted activities.
  • Behavioral Change: CodexAdapter no longer emits events for thread/tokenUsage/updated; only codex/event/token_count produces token usage events.

Macroscope summarized 479d66b.

Add in context limit view UI based on last.totalTokens.

  * Displays ring showing amount of context being used
  * On click displays actual numbers
  * Collapses into the ... UI when window is shrunk
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 04277e8f-ab87-4c8b-b923-5cbea8a1f625

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can enable review details to help with troubleshooting, context usage and more.

Enable the reviews.review_details setting to include review details such as the model used, the time taken for each step and more in the review comments.

@github-actions github-actions bot added size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion to add Context Limit viewer

1 participant