Skip to content

feat(overview): unified all-providers card with cross-provider totals - #2577

Closed
Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:feat/overview-unified-card
Closed

feat(overview): unified all-providers card with cross-provider totals#2577
Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:feat/overview-unified-card

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Reworks the merged Overview from a per-provider card list into a single unified card, so the whole fleet's live state is visible at a glance and per-provider detail stays one drill-in away.

  • Totals header: cross-provider aggregate (cost grouped by currency with preferred-currency conversion, total tokens, coverage days), built on each provider's published 30-day token snapshot. Gated by the existing costUsageEnabled setting.
  • Chip grid: every enabled provider appears exactly once — status dot, name, right-aligned remaining percent, and a mini quota bar. Errored providers render as inline error chips (icon + short error text); exhausted providers show a red 0% state. No duplicated attention lines.
  • Reset line: the only extra row, showing upcoming quota resets (up to 2 providers) — incremental info not already visible in the grid.
  • Drill-in: clicking the card opens Preferences → Usage & Spend; the row submenu lists every contributing provider and jumps to that provider's detail card. Refresh works through both rebuild and in-place reconcile paths (identifier + height fingerprint).

Relationship to existing asks: implements the menu-side surface of #2065 (closed as completed on the data side); takes a different direction than #2107 / #2339 — instead of compacting or re-configuring the per-provider list, it aggregates. If maintainers prefer the compact-list direction, this PR can be scoped down to just the totals row.

Open discussion

The provider-section layout has three candidate directions (full-width list rows / big-number stat tiles / chip grid); discussion is in #2578. The totals aggregation, model, submenu, and refresh mechanics are layout-independent and ready for review.

Test

  • swift test --filter 'StatusMenuOverviewUnifiedTests|OverviewTotalsModelTests' — 15 tests (aggregation grouping/conversion/overflow, unified card presence, error chip exactly-once, reset lines, submenu drill-in, refresh)
  • Regression: StatusMenuSwitcherLayoutTests, StatusMenuMergedOverviewRefreshTests, StatusMenuOverviewScrollTests, UsageMenuCardLayoutTests, SettingsStoreTests, MenuCardModelTests — 171 tests pass on latest main
  • make check — 0 violations; locale key parity verified across all 24 locales

Replace the merged Overview's per-provider card list with a single
unified card: a cross-provider totals header (cost grouped by currency,
tokens, coverage), a two-column chip grid with every enabled provider's
live quota, and an incremental reset-info line. Each provider appears
exactly once: errored providers render as inline error chips, exhausted
providers show a red empty state. Click opens Preferences > Usage &
Spend; the row submenu lists contributors and jumps to provider detail.
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

Design discussion for the provider-section layout lives in #2578 — three candidate directions (full-width rows / stat tiles / chip grid). Totals aggregation and drill-in mechanics are layout-independent and reviewable now.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 11:51 AM ET / 15:51 UTC.

ClawSweeper review

What this changes

The branch replaces merged Overview provider cards with one aggregate all-provider card containing token/cost totals, quota chips, reset information, and provider-detail drill-ins.

Merge readiness

Blocked until real behavior proof is added - 11 items remain

Keep this PR open. The prior blockers remain at the current head: it bypasses the user’s configured Overview provider subset and renders used-percentage data as remaining quota. The feature’s layout direction is also still under active product discussion in #2578, and no after-fix native-menu proof has been supplied.

Priority: P3
Reviewed head: d2087228c6f4c2d96fc09cc68f1cbd240da12bd3
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation has useful focused tests, but two confirmed behavior regressions and missing real native-menu proof leave it unready to merge.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports tests but provides no after-fix native-menu screenshot, recording, live output, or redacted runtime log; add fresh-bundle proof after fixing the blockers and redact account or other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports tests but provides no after-fix native-menu screenshot, recording, live output, or redacted runtime log; add fresh-bundle proof after fixing the blockers and redact account or other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Configured selection on current main: Current main resolves the persisted Overview subset with reconcileMergedOverviewSelectedProviders before creating menu rows, so the selection is an established compatibility boundary.
PR bypasses Overview selection: The proposed unified-model builder iterates its enabledProviders argument directly for quota rows and totals rather than resolving the configured Overview subset first.
Used-mode percentage semantics: Current main constructs a metric’s percent from usedPercent when usageBarsShowUsed is enabled; the PR records that raw value as remainingPercent, which drives both exhaustion and bar fill.
Findings 2 actionable findings [P1] Honor the configured Overview provider selection
[P2] Normalize remaining quota before rendering the chip
Security None None.

How this fits together

CodexBar’s merged Overview converts the configured subset of enabled provider snapshots into the macOS menu-bar popover. This PR changes the transformation and presentation layer, affecting displayed providers, quota state, refresh behavior, and navigation to Usage & Spend.

flowchart LR
  A[Enabled providers] --> B[Configured Overview subset]
  C[Provider usage snapshots] --> D[Quota and total model]
  B --> D
  D --> E[Unified Overview card]
  E --> F[Menu refresh]
  E --> G[Provider detail submenu]
  G --> H[Usage and Spend settings]
Loading

Decision needed

Question Recommendation
Should the merged Overview replace provider cards with a unified aggregate card now, and if so which provider-section layout from #2578 should be the supported direction? Approve a chosen unified layout: Select a candidate layout, then require the focused compatibility fixes and real native-menu proof before merge.

Why: The code can be mechanically corrected, but whether this feature replaces the existing provider-card presentation and which density/layout tradeoff is acceptable is a product decision rather than a correctness inference.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports tests but provides no after-fix native-menu screenshot, recording, live output, or redacted runtime log; add fresh-bundle proof after fixing the blockers and redact account or other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Honor the configured Overview provider selection (P1) - Resolve the persisted Overview subset before building this model. Iterating every enabled provider brings unchecked and over-limit providers back into the card and totals, while refresh still uses the configured subset, so those extra chips can be stale. This is the still-unfixed P1 from the previous review cycle.
  • Normalize remaining quota before rendering the chip (P2) - When “show used” is enabled, primary.percent is used quota, but this stores it as remainingPercent. An exhausted provider then has 100 here, so both the mini bar and exhausted-state color are inverted. This is the still-unfixed P2 from the previous review cycle.
  • Resolve merge risk (P1) - Merging as written can make unchecked or over-limit providers reappear in Overview and can display stale snapshots because refresh selection still follows the configured subset.
  • Resolve merge risk (P1) - With “show used” enabled, exhausted providers can appear full and retain their normal color rather than the intended red exhausted state.
  • Resolve merge risk (P1) - Replacing the existing card list before the active layout discussion resolves can lock in a UI direction that maintainers may not want.
  • Complete next step (P2) - A maintainer must first choose the intended unified Overview layout; the contributor must then address the two concrete regressions and provide real native-menu behavior proof.
  • Improve patch quality - Use the resolved Overview provider subset for all unified-card inputs and add excluded/over-limit regression coverage.
  • Improve patch quality - Represent actual remaining quota separately from the selected used-versus-left display label and test exhausted state in both modes.
  • Improve patch quality - After the layout decision and fixes, add a redacted fresh-bundle screenshot or recording covering selected, excluded, errored, and exhausted providers; updating the PR body should trigger re-review, or ask a maintainer to comment @clawsweeper re-review.

Findings

  • [P1] Honor the configured Overview provider selection — Sources/CodexBar/StatusItemController+OverviewTotals.swift:28
  • [P2] Normalize remaining quota before rendering the chip — Sources/CodexBar/StatusItemController+OverviewTotals.swift:53-54
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 31 files, 1,068 added, 68 removed The feature spans menu rendering, totals modeling, tests, actions, and localization, so compatibility needs review beyond the visual card.
Localization updates 24 locale resources changed The new Overview labels affect every supported menu locale and need the intended user-visible copy checked alongside the layout.

Merge-risk options

Maintainer options:

  1. Preserve Overview selection semantics (recommended)
    Resolve the configured Overview subset once and use that same list for totals, rendered chips, refresh, and submenu entries; add regression coverage for excluded and over-limit providers.
  2. Accept an intentional selection change
    If maintainers want every enabled provider to override the existing Overview subset, explicitly document the migration and verify refresh behavior for providers outside the former selection.
  3. Pause for layout direction
    Defer the replacement card until the provider-section design has a maintainer-approved direction.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Keep the unified Overview scoped to resolved selected providers, normalize used versus remaining quota state, and add focused regression tests; real behavior proof is still required from the contributor.

Technical review

Best possible solution:

Choose the Overview layout direction in #2578, then preserve the resolved provider subset throughout totals, rows, refresh, and submenu generation; normalize quota state to actual remaining percentage and validate it with fresh-bundle native-menu proof.

Do we have a high-confidence way to reproduce the issue?

Yes for the two code-level regressions: configure a strict Overview subset or enable “show used,” then build the unified model with an excluded provider or exhausted quota. No live app run was performed because this review is read-only, but the current-main and PR source paths establish both failures.

Is this the best way to solve the issue?

No. The aggregate-card direction may be useful, but it must first honor established Overview selection and percentage semantics; its final layout also needs the maintainer choice documented in #2578.

Full review comments:

  • [P1] Honor the configured Overview provider selection — Sources/CodexBar/StatusItemController+OverviewTotals.swift:28
    Resolve the persisted Overview subset before building this model. Iterating every enabled provider brings unchecked and over-limit providers back into the card and totals, while refresh still uses the configured subset, so those extra chips can be stale. This is the still-unfixed P1 from the previous review cycle.
    Confidence: 0.99
  • [P2] Normalize remaining quota before rendering the chip — Sources/CodexBar/StatusItemController+OverviewTotals.swift:53-54
    When “show used” is enabled, primary.percent is used quota, but this stores it as remainingPercent. An exhausted provider then has 100 here, so both the mini bar and exhausted-state color are inverted. This is the still-unfixed P2 from the previous review cycle.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2bd6a6c37eff.

Labels

Label justifications:

  • P3: This is a discretionary Overview presentation feature, not an urgent reliability, data-loss, or security regression.
  • merge-risk: 🚨 compatibility: The branch bypasses the existing persisted Overview provider subset and changes how existing used-versus-remaining display preferences are interpreted.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports tests but provides no after-fix native-menu screenshot, recording, live output, or redacted runtime log; add fresh-bundle proof after fixing the blockers and redact account or other private data. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

Acceptance criteria:

  • [P1] swift test --filter 'StatusMenuOverviewUnifiedTests|OverviewTotalsModelTests'.
  • [P1] make check.
  • [P1] Fresh-bundle native Overview proof covering selected, excluded, errored, and exhausted providers.

What I checked:

  • Configured selection on current main: Current main resolves the persisted Overview subset with reconcileMergedOverviewSelectedProviders before creating menu rows, so the selection is an established compatibility boundary. (Sources/CodexBar/StatusItemController+Menu.swift:563, 2bd6a6c37eff)
  • PR bypasses Overview selection: The proposed unified-model builder iterates its enabledProviders argument directly for quota rows and totals rather than resolving the configured Overview subset first. (Sources/CodexBar/StatusItemController+OverviewTotals.swift:28, d2087228c6f4)
  • Used-mode percentage semantics: Current main constructs a metric’s percent from usedPercent when usageBarsShowUsed is enabled; the PR records that raw value as remainingPercent, which drives both exhaustion and bar fill. (Sources/CodexBar/MenuCardView.swift:1330, 2bd6a6c37eff)
  • PR’s exhausted-state calculation: The PR assigns primary.percent to remainingPercent while its view treats zero remainingPercent as exhausted and uses remainingPercent for the mini-bar width. (Sources/CodexBar/StatusItemController+OverviewTotals.swift:53, d2087228c6f4)
  • Feature-history routing: Recent current-main history shows sustained merged-Overview and menu-refresh work by steipete, while Yuxin-Qiao previously landed preferred-currency and multi-currency cost-display work that is adjacent to the new totals surface. (Sources/CodexBar/StatusItemController+Menu.swift:554, cd49d30fad95)
  • Real-behavior proof is absent: The PR body reports focused tests and checks, but the supplied body, comments, and timeline contain no screenshot, recording, terminal output, or redacted runtime log showing the updated native Overview behavior.

Likely related people:

  • steipete: Recent current-main commits cover the merged menu’s view swapping, stable height, tab switching, and refresh behavior that this PR changes. (role: recent area contributor; confidence: high; commits: cd49d30fad95, 85bf75281a00; files: Sources/CodexBar/StatusItemController+Menu.swift, Sources/CodexBar/StatusItemController+MenuTracking.swift)
  • Yuxin-Qiao: Prior merged work added preferred-currency and multi-currency cost display, directly adjacent to this PR’s cross-provider totals model. (role: adjacent totals and currency contributor; confidence: medium; commits: e1e2cc20272a, 8909956edbb3; files: Sources/CodexBar/OverviewTotalsModel.swift, Sources/CodexBar/StatusItemController+OverviewTotals.swift)

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-02T13:40:39.470Z sha d208722 :: needs real behavior proof before merge. :: [P1] Respect the configured Overview provider selection
  • reviewed 2026-08-02T15:17:17.791Z sha d208722 :: needs real behavior proof before merge. :: [P1] Honor the configured Overview provider selection | [P2] Normalize used percentages before rendering quota state

@Yuxin-Qiao
Yuxin-Qiao marked this pull request as ready for review August 2, 2026 14:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2087228c6

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

if index < rows.count - 1 {
menu.addItem(.separator())
}
guard let unifiedModel = self.makeOverviewUnifiedModel(enabledProviders: enabledProviders) else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor the configured Overview provider subset

When the user has selected only some providers for Overview, this passes every enabled provider into the unified model, so unchecked providers—and providers beyond mergedOverviewProviderLimit—reappear in the card and totals. renderedProviders(for:) still resolves the configured subset, so those extra providers are not necessarily refreshed and may also display stale data. Resolve/reconcile the Overview selection before building the model, as the previous implementation did.

AGENTS.md reference: AGENTS.md:L4-L4

Useful? React with 👍 / 👎.

Comment on lines +53 to +54
remainingPercent: primary.percent,
usedPercent: min(100, max(0, usedPercent)),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect exhaustion in used-percentage mode

When usageBarsShowUsed is enabled, primary.percent is the used percentage, but it is stored as remainingPercent. Consequently, an exhausted quota has remainingPercent == 100, while OverviewQuotaRow.isExhausted only recognizes zero, so the chip keeps the provider branding color instead of showing the red exhausted state. Store the actual remaining value independently or base exhaustion on the normalized usedPercent.

Useful? React with 👍 / 👎.

@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Maintainer decision on the Usage & Spend program (applies to #2322, #2527, #2548, #2569, #2575, #2577 — closing together):

We want the ideas — the token-activity view and the cross-provider cost overview in particular are genuinely good, and we're adopting them. What we can't absorb is the delivery shape: 8k–20k-line PRs bundling scanners, pricing, identity, and UI can't be reviewed honestly, and live testing of the current heads surfaced the kind of defects that big surfaces hide (duplicate token-activity cards in the Models view; the unified Overview rendering no chip for an enabled provider; the account-attribution issue flagged earlier).

So we're taking this work as a base in-house and rebuilding it in small, individually landable slices — first the token-activity view rebuilt on the shared scan cache (no separate annual scan), then the cost overview aligned with the #2578 design discussion. Your commits will be cherry-picked where they fit, and every slice that draws on this work will credit you in the changelog, as today's merges already do.

@Yuxin-Qiao — you're this repo's most prolific contributor and much of today's release is your work. Focused PRs the size of #2574 land same-day; that's the shape that serves both of us.

@steipete steipete closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants