Skip to content

Studio: compact context usage ring when the chat header is squeezed - #12355

Merged
shimmyshimmer merged 2 commits into
mainfrom
studio-context-usage-compact
Oct 1, 2026
Merged

shimmyshimmer merged 2 commits into
mainfrom
studio-context-usage-compact

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

When the chat column gets narrow (for example with a side panel open), the context usage button in the chat header wraps "177 / 35.3k" onto two lines next to a squashed bar. The icon buttons beside it also shrink and can get clipped.

The button now steps down cleanly as space runs out:

  1. Full: 44 / 131.1k with the usage bar, as today.
  2. Ring: a ring gauge on its own, the same size as the header icons beside it. It uses the same accent, amber and red thresholds as the bar, and the tooltip still gives the exact percentage. Without a known context window (external providers) the token count stands in for the ring.

Only after the ring is fully compact does the model name start to truncate, and the header icons never shrink. Hover, focus and the tooltip cover only the face that is showing, so a squeezed button has no dead hover area around the ring. The tooltip content is unchanged.

Changes

  • context-usage-bar.tsx
    • The header squeezes a wrapper: a one-column grid with a minmax(compact, full) track. The full width is exact in ch, since the wrapper and face are in the mono font.
    • The button inside is right-aligned and sized by clamp() to the full face when it fits, else to the compact one (an icon-sized square for the ring). Both layouts share the button's grid cell and only the matching one has width. It is all CSS, with no resize observers.
    • Also fixes contextUnboundedWhenBatched and parallelSlots being dropped before they reached deriveContextUsageBar, so the unenforced limit advice now shows for batched servers.
  • context-usage-bar-state.ts: adds compactFace, the text shown instead of the ring when there is no window to fill (null shows the ring).
  • chat-page.tsx, header only:
    • The right group starts at its minimum and grows to its natural width (basis-0 grow min-w-min max-w-max). Only the model selector shrinks, and only once the context button can't get any smaller.
    • The icons and the desktop New chat button are shrink-0.

Testing

  • New tests/context-usage-compact.test.ts covers the compact face for each state, the prop forwarding and the header classes.
  • npm run typecheck is clean and npm test passes, apart from the existing More menu test that also fails on main.
  • Checked in a local build at several widths, in light and dark themes:
    • full at 1440px with no side panel
    • the ring alone as a side panel opens and the window narrows, with hover and the tooltip limited to the ring
    • the model name truncates only after that, with icons at a steady 30px
    • compare mode is unchanged

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 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 ✅ Completed 2026-10-01T06:52:08.047240Z 639a454 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: f479dceb7a

ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member

Two notes on the red checks here:

…er icons

- The compact face is the ring alone; the tooltip keeps the exact
  percentage. Without a known window the token count still stands in.
- The ring is icon sized, matching the temporary chat and sidebar icons.
- The header squeezes a wrapper, and the button inside takes only the
  face it shows, so hover, focus and the tooltip cover just the ring.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 639a4548d7

ℹ️ 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".

@shimmyshimmer
shimmyshimmer merged commit b96af04 into main Oct 1, 2026
41 of 42 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-context-usage-compact branch October 1, 2026 07:26
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