Repository navigation
fix(ui): show plan usage only for the session provider - #132972
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 9:29 PM ET / August 30, 2026, 01:29 UTC. ClawSweeper reviewWhat this changesThe PR limits the chat context popover’s plan-usage section to the active session provider, falling back to the latest real assistant message when session provider metadata is unavailable. Merge readinessKeep open: current main still renders all available plan-usage groups, while this focused branch selects only the session’s matching provider group. The PR is MEMBER-authored and carries the protected Priority: P2 Review scores
Verification
How this fits togetherThe Control UI combines Gateway session rows, chat transcript messages, and provider usage snapshots in the chat composer. The resulting context popover shows session usage and the subscription-plan usage relevant to that session. flowchart LR
A[Gateway session row] --> D[Chat composer]
B[Transcript messages] --> D
C[Provider usage snapshots] --> E[Quota group collection]
D --> F[Resolve session provider]
E --> G[Match provider group]
F --> G
G --> H[Context usage popover]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +70. Total +71 across 3 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use the selected session’s provider as the canonical plan-usage identity, fall back to the latest real assistant provider only when that identity is absent, and render one alias-matched quota group. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main’s renderer emits every quota group, and the PR’s deterministic component and mocked-Gateway browser fixtures supply an OpenAI session plus unrelated Copilot usage. No local test execution was performed in this read-only review. Is this the best way to solve the issue? Yes. Provider selection belongs in the context-popover renderer and must be independent of cost extraction, since a session can have plan usage without a cost-bearing assistant message. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7926e300228. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Co-authored-by: Jason Sy <[email protected]>
What Problem This Solves
Fixes an issue where users opening the chat context-usage popover could see plan usage from unrelated configured providers. For example, an OpenAI session with both OpenAI and Copilot usage snapshots rendered both plans, while a session with only a Copilot snapshot presented Copilot usage as if it applied to the OpenAI session.
Why This Change Was Made
The popover now determines the current provider from the session model provider, falling back only to the latest real assistant message when the session provider is absent. It renders one matching plan-usage group or no Plan Usage section, without changing the existing context-window, latest-run token, and estimated-cost details.
User Impact
The context wheel no longer attributes another provider's subscription plan to the current session. Sessions without a matching plan snapshot still show their context and cost details.
Evidence
Before
The regression fixture has an OpenAI session and both OpenAI and Copilot plan snapshots. Before the source fix, the browser assertion found two provider-usage links and the popover displayed both plans.
After
The same fixture now displays only the matching OpenAI plan. The context window and latest-run token details remain visible.
Verification
pnpm test ui/src/pages/chat/chat-composer-context.test.ts: 8 passednode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-quota-pill-93041.e2e.test.ts: 5 passedpnpm check:changed: passedpnpm test:changed: 797 UI files, 3 isolated files, and 1 E2E file passed; 11,958 tests passed and 86 skipped across the three shardspnpm ui:build: passed, including Control UI performance limits and 796 finalized sidecarsorigin/main: no accepted or actionable findingsThe first full changed-test run hit two transient layout assertions in an unrelated responsive browser test. Its isolated rerun passed 111 tests, and the complete changed-test rerun then passed.
AI-assisted: yes. I reviewed the repository instructions, source history, tests, browser output, and final diff.