Skip to content

Show partial spend totals when some subscriptions lack prices - #3001

Merged
steipete merged 1 commit into
steipete:mainfrom
Yuxin-Qiao:fix/spend-dashboard-partial-group-totals
Aug 17, 2026
Merged

Show partial spend totals when some subscriptions lack prices#3001
steipete merged 1 commit into
steipete:mainfrom
Yuxin-Qiao:fix/spend-dashboard-partial-group-totals

Conversation

@Yuxin-Qiao

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

Copy link
Copy Markdown
Contributor

Summary

  • Show partial spend totals when some subscriptions lack prices.
  • Sum priced subscriptions instead of making the whole currency group unavailable.

Note

  • Privacy-sensitive screenshots were removed from this PR description.

A nil cost on one subscription no longer wipes the currency group header.

Co-authored-by: Cursor <cursoragent@cursor.com>
@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

@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: c9f3bf7291

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

dailyPoints: dailyPoints,
totalTokens: Self.completeIntSum(providers.map(\.totalTokens)),
totalCost: Self.completeCostSum(providers.map(\.totalCost)),
totalTokens: Self.knownIntSum(providers.map(\.totalTokens)),

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 Label summed known tokens as partial

When one subscription has totalTokens == nil—for example because its history is malformed or overflows—and another reports tokens, this now stores the known-only sum in CurrencyGroup.totalTokens. The dashboard renders that value as an unqualified “Tracked tokens” total, and Share Stats propagates it as <n> tracked tokens; hasPartialTokens is not consumed anywhere, so users see a lower bound as a complete total. Either keep this aggregate unavailable or propagate and display its partial state as is done for spend.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. 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. labels Aug 17, 2026
@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 17, 2026, 8:55 AM ET / 12:55 UTC.

ClawSweeper review

What this changes

The PR retains priced subscription spend in currency totals when peers lack prices, labels partial spend in the dashboard and Share Stats, and adds localization and regression coverage.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

Keep open: the branch correctly makes partial spend explicit, but still presents known-only tracked-token sums as complete totals on this unchanged head.

Priority: P2
Reviewed head: c9f3bf7291543ec6f1e21759fdff6f957591f8fc

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The partial-spend proof is convincing, but an unchanged P2 token-presentation defect remains before the patch is merge-ready.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Prepared screenshots demonstrate the intended partial currency subtotal and unavailable peer subscription; native proof is on a stacked branch that includes this commit, while the remaining blocker is source-visible token presentation.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Prepared screenshots demonstrate the intended partial currency subtotal and unavailable peer subscription; native proof is on a stacked branch that includes this commit, while the remaining blocker is source-visible token presentation.
Evidence reviewed 6 items Current main behavior: Current main retains all-or-nothing cost and token sums, so the requested partial-spend behavior is not already implemented there.
Unmarked partial token aggregate: The PR changes token aggregation to retain known values and defines hasPartialTokens, but the dashboard renders totalTokens without consulting that state.
Share Stats repeats the defect: ShareStatsBuilder skips unavailable groups when summing tokens and ShareStatsFormatting emits the resulting count without a partial marker.
Findings 1 actionable finding [P2] Mark known-only token totals as partial
Security None None.

How this fits together

CodexBar combines per-provider usage snapshots into currency groups for the Usage & Spend dashboard and Share Stats. Those aggregates feed visible spend and tracked-token summaries as well as copied statistics.

flowchart LR
A[Provider usage snapshots] --> B[Currency group aggregation]
B --> C[Known totals and partial state]
C --> D[Usage and Spend dashboard]
C --> E[Share Stats payload]
D --> F[Visible account summary]
E --> G[Copied statistics]
Loading

Before merge

  • Mark known-only token totals as partial (P2) - This changes totalTokens from fail-closed to a known-only sum whenever one provider has nil tokens. hasPartialTokens is never consumed by the dashboard or Share Stats, so users see a lower bound as a complete tracked-token total. This is the still-unfixed prior finding on the unchanged head.
  • Resolve merge risk (P1) - Merging this head changes incomplete tracked-token aggregates into lower bounds while displaying them as complete totals in both the dashboard and shared text.
  • Complete next step (P2) - A narrow, source-proven repair can address the remaining display defect without changing provider acquisition or pricing policy.

Findings

  • [P2] Mark known-only token totals as partial — Sources/CodexBar/SpendDashboardModel.swift:281
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch scope 33 files, +276/-40 The focused aggregation change also updates 23 localization catalogs and several dashboard and Share Stats tests.

Root-cause cluster

Relationship: canonical
Canonical: #3001
Summary: This PR owns the partial currency-group aggregation; the later all-time dashboard PR partially overlaps because it adds a token-display repair on top of this work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Mark partial token totals (recommended)
    Preserve the known-only aggregation but visibly mark partial tracked-token values in the dashboard and Share Stats before merging.
  2. Restore unavailable token totals
    Keep tracked-token totals unavailable whenever a contributing subscription is unknown, retaining the previous fail-closed behavior.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Propagate partial-token state through dashboard and Share Stats displays, with focused complete and partial regression coverage.

Technical review

Best possible solution:

Propagate explicit partial-token state through both consumers, matching the established partial-spend treatment, and add complete-versus-partial regression coverage.

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

Yes—construct a currency group with one known token total and one nil token total; this head returns the known-only sum and renders it without a partial marker.

Is this the best way to solve the issue?

No—the spend path is appropriately marked, but the same known-only token semantics need explicit propagation or restoration of the former fail-closed behavior.

Full review comments:

  • [P2] Mark known-only token totals as partial — Sources/CodexBar/SpendDashboardModel.swift:281
    This changes totalTokens from fail-closed to a known-only sum whenever one provider has nil tokens. hasPartialTokens is never consumed by the dashboard or Share Stats, so users see a lower bound as a complete tracked-token total. This is the still-unfixed prior finding on the unchanged head.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 14e300389e9e.

Labels

Label justifications:

  • P2: The patch can show a materially incomplete tracked-token total as complete, but the blast radius is limited to Usage & Spend and Share Stats.
  • merge-risk: 🚨 compatibility: Existing users with incomplete provider history would see a changed aggregate semantic without an indication that the number is a lower bound.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): Prepared screenshots demonstrate the intended partial currency subtotal and unavailable peer subscription; native proof is on a stacked branch that includes this commit, while the remaining blocker is source-visible token presentation.
  • proof: sufficient: Contributor real behavior proof is sufficient. Prepared screenshots demonstrate the intended partial currency subtotal and unavailable peer subscription; native proof is on a stacked branch that includes this commit, while the remaining blocker is source-visible token presentation.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Prepared screenshots demonstrate the intended partial currency subtotal and unavailable peer subscription; native proof is on a stacked branch that includes this commit, while the remaining blocker is source-visible token presentation.

Evidence

Acceptance criteria:

  • [P1] swift test --filter SpendDashboardPartialCostTests.
  • [P1] swift test --filter ShareStatsTests.
  • [P1] make check.
  • [P1] make test.

What I checked:

Likely related people:

  • steipete: Feature history shows sustained ownership of the affected dashboard and Share Stats paths, including the recent partial-spend fix. (role: recent area contributor; confidence: high; commits: 6407d3ce3346, b5806aa363dd; files: Sources/CodexBar/SpendDashboardModel.swift, Sources/CodexBar/ShareStatsPayload.swift, Sources/CodexBar/PreferencesSpendDashboardPane.swift)
  • Alec Gutman: Introduced the unified Usage & Spend dashboard that owns the affected aggregation and presentation surface. (role: feature introducer; confidence: high; commits: 0397529ae6e5; files: Sources/CodexBar/SpendDashboardModel.swift, Sources/CodexBar/PreferencesSpendDashboardPane.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Mark partial tracked-token totals in the dashboard and Share Stats output.
  • Add focused regression assertions for complete and partial token aggregates on this PR head.

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 (3 earlier review cycles)
  • reviewed 2026-08-17T05:46:13.664Z sha c9f3bf7 :: needs real behavior proof before merge. :: [P2] Keep incomplete token totals unavailable
  • reviewed 2026-08-17T08:24:02.498Z sha c9f3bf7 :: needs changes before merge. :: [P2] Mark known-only token sums as partial
  • reviewed 2026-08-17T10:55:47.794Z sha c9f3bf7 :: needs changes before merge. :: [P2] Mark known-only token sums as partial

@Yuxin-Qiao

Yuxin-Qiao commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

After-fix proof

The motivating live dashboard was Codex priced (~$329.61 / 30d) with Claude and Cursor as spend unavailable, so the USD group header was .

This PR’s aggregation keeps the priced subtotal. The Share Stats card below is the same SwiftUI renderer the app uses, generated from this stacked branch (#3009 includes c9f3bf729):

  • USD · 0/30d ~$4.00 while Cursor remains Spend unavailable
  • Share text: USD: $4.00 estimated (partial) · coverage 0/30 days
  • Focused: priced subscription keeps group spend when peers lack prices (group total 4, hasPartialCost, 1 of 3 subscriptions have spend)

hasPartialTokens presentation (~ on tracked tokens + share-card ~) is on #3009, not this SHA.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 17, 2026
@Yuxin-Qiao

Yuxin-Qiao commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Native Usage & Spend section (stacked #3009 includes this SHA)

Priced Claude stays in the currency total while Cursor is spend unavailable. 30d:

Partial token ~ on the Share Stats card is on #3009 (ec998ded0), not this head.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@Yuxin-Qiao

Yuxin-Qiao commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Native Usage & Spend (this machine)

30天: USD header is ~$310.40 with 部分估算 · 1 / 2 个订阅有支出数据. Codex priced, Claude spend unavailable. Tracked tokens show ~.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 17, 2026

Copy link
Copy Markdown

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@steipete
steipete merged commit fe5df2d into steipete:main Aug 17, 2026
9 checks passed
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

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. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants