feat(sessions): context breakdown popover#2353
Draft
k11kirky wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced May 25, 2026
8b5cff8 to
b68e4e4
Compare
7032aef to
78a3903
Compare
This was referenced May 25, 2026
Replaces the simple tooltip on the inline context indicator with a
Radix popover that mirrors the design spec: an aggregate header
("~74K / 200K tokens", "37% full"), a multi-segment progress bar
colored by source, and a per-category token list (System prompt,
Tools, Rules, Skills, MCP, Subagents, Conversation) with zero-token
rows hidden. The inline label now reads "X/Y · Z%" so the percent
is glanceable without opening the popover.
The popover consumes the new `breakdown` field from `useContextUsage`
(plumbed in B3). When the breakdown is missing — e.g. before the
first response of a session — the popover falls back to a single
percent bar and surfaces a one-line placeholder explaining that
detail will arrive after the first response. Color choices and the
`formatTokensCompact` helper are lifted into a shared
`contextColors` module so both the indicator and popover read from
the same source.
Generated-By: PostHog Code
Task-Id: bac06178-1ab1-4000-9a56-1901215bd4af
Generated-By: PostHog Code
Task-Id: bac06178-1ab1-4000-9a56-1901215bd4af
b68e4e4 to
ebe1dbc
Compare
78a3903 to
00f8802
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
The context usage indicator previously showed only a tooltip with raw token counts. Users had no way to see how their context window was being consumed across different categories (system prompt, tools, rules, skills, MCP, subagents, conversation).
Changes
ContextUsageIndicatorwith a RadixPopoverthat opens aContextBreakdownPopoverpanel when clicked.ContextBreakdownPopoverdisplays the aggregate token count, percentage full, a visual progress bar, and a per-category breakdown with color-coded segments when breakdown data is available. Before the first response, a placeholder message is shown instead.getOverallUsageColor,formatTokensCompact, andCONTEXT_CATEGORIES) intocontextColors.tsso they can be reused across both components.74K/200K · 37%).How did you test this?
Added unit tests in
ContextBreakdownPopover.test.tsxcovering:null.Publish to changelog?
no