Skip to content

fix(ui): show plan usage only for the session provider - #132972

Merged
fuller-stack-dev merged 1 commit into
mainfrom
fix/context-wheel-provider-usage
Aug 30, 2026
Merged

fuller-stack-dev merged 1 commit into
mainfrom
fix/context-wheel-provider-usage

Conversation

@fuller-stack-dev

Copy link
Copy Markdown
Member

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.

Before: OpenAI and unrelated Copilot plan usage are both shown

After

The same fixture now displays only the matching OpenAI plan. The context window and latest-run token details remain visible.

After: only matching OpenAI plan usage is shown

Verification

  • pnpm test ui/src/pages/chat/chat-composer-context.test.ts: 8 passed
  • node 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 passed
  • pnpm check:changed: passed
  • pnpm test:changed: 797 UI files, 3 isolated files, and 1 E2E file passed; 11,958 tests passed and 86 skipped across the three shards
  • pnpm ui:build: passed, including Control UI performance limits and 796 finalized sidecars
  • Autoreview against origin/main: no accepted or actionable findings

The 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.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review August 30, 2026 01:19
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 30, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 9:29 PM ET / August 30, 2026, 01:29 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 3 items remain

Keep 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 maintainer label, so it should continue through normal exact-head CI and maintainer review.

Priority: P2
Reviewed head: 6c7fcf14aa86b2382c042f8bd7f3ad9720320740

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-covered UI correction with no concrete introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: The PR author is a repository MEMBER, so the external-contributor proof gate does not apply. The body supplies before/after browser attachments and focused validation claims; this reviewer could not retrieve the attachments because network DNS was unavailable, which does not require contributor action.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR author is a repository MEMBER, so the external-contributor proof gate does not apply. The body supplies before/after browser attachments and focused validation claims; this reviewer could not retrieve the attachments because network DNS was unavailable, which does not require contributor action.
Evidence reviewed 5 items Current-main behavior: The fetched main revision still builds an ordered list containing the current group and every other quota group, then renders all of them; it does not implement the requested single-group behavior.
Introduced renderer fix: The branch resolves the current provider from the selected session, or the latest non-transcript assistant message, finds one matching quota group, and renders only it.
Caller and data contract: The composer passes the selected session, transcript messages, and provider usage to this renderer; quota groups deliberately retain both the auth provider and normalized usage-provider identifiers for alias matching.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +1 line for this bug fix; the added provider-only scan is justified because cost extraction stops at the latest user turn and cannot supply plan provenance when cost data is absent.
  • Resolve merge risk (P1) - Exact-head CI was still in progress in the reviewed snapshot; this is not a code finding but must complete before merge.
  • Complete next step (P2) - No mechanical repair is indicated; retain this focused PR for normal exact-head CI and maintainer review.
Agent review details

Security

None.

PR surface

Source +1, Tests +70. Total +71 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 24 23 +1
Tests 2 82 12 +70
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 106 35 +71

Review metrics

Metric Value Why it matters
Production versus test LOC production +24/-23 (net +1); tests +82/-12 (net +70) The small production increase separates provider provenance from cost parsing; the remaining change is behavior-level regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This corrects misleading provider-plan attribution in the web chat context popover with limited blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: This corrects misleading provider-plan attribution in the web chat context popover with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Evidence

What I checked:

Likely related people:

  • Alix-007: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@fuller-stack-dev
fuller-stack-dev merged commit af7c655 into main Aug 30, 2026
326 of 335 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/context-wheel-provider-usage branch August 30, 2026 03:35
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant