Skip to content

Show Claude Platform balance in widget - #5201

Open
dex157 wants to merge 4 commits into
steipete:mainfrom
dex157:widget-claude-platform-balance
Open

dex157 wants to merge 4 commits into
steipete:mainfrom
dex157:widget-claude-platform-balance

Conversation

@dex157

@dex157 dex157 commented Nov 27, 2026

Copy link
Copy Markdown

Fixes #5200

Summary

  • Widget snapshot now fills balanceText for Claude Platform from its prepaid credit balance (same resolver the menu bar uses).
  • Balance respects the "show optional credits and extra usage" setting (now passed for all balance-text providers; DeepSeek/OpenRouter paths ignore the flag, so no behavior change for them).
  • WidgetBalanceFormatter.providerBalance accepts .claudeplatform, so the widget renders a "Balance" row; credit-grant lanes keep the headline.

Commands

  • swift test --filter "ProviderWidgetAvailabilityTests|WidgetEmptyProjectionTests|StatusItemBalanceDisplayTests" — passed
  • swiftlint lint --strict, swiftformat --lint Sources Tests — clean
  • Full make test not run locally.

🤖 Generated with Claude Code

Fixes steipete#5200

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T00:59:36.156499Z 8aeba54 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 27, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge.

What this changes

This PR displays Claude Platform prepaid balances in widgets using the existing balance resolver and optional-credit visibility setting.

Example: Claude Platform reports $42.50 in prepaid credits with optional credits enabled.

  • Before: The widget shows credit-grant percentages without the total prepaid balance.
  • After: The widget also displays Balance $42.50.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-consistent, but required shipped-widget proof is absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Claude Platform users can see total prepaid dollars in the menu but only grant percentages in the widget.
Reason: This is a small extension of existing provider-driven widget presentation, consistent with repository direction and requiring no new setting or bespoke UI.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open: it addresses a current widget display gap with a focused change, and source review found no definite introduced defect.

Reviewed head: 917f812e120b7ea4b66f4288378384594eade842

Before merge

  • Add real behavior proof - The added tests exercise production snapshot publication and balance presentation with synthetic $42.50 data, and the author reports focused tests passing, but no supplied artifact exercises the installed WidgetKit path or visibility toggle; the contributor should supply that capture with personal data and credentials redacted. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Provide installed-widget screenshots or a recording showing the Claude Platform dollar balance alongside grant quotas and its removal when optional credits are hidden; supplied results also do not demonstrate base-fail/head-pass regression execution.
Agent review details

How this fits together

UsageStore converts provider measurements and display preferences into shared JSON snapshots, which the WidgetKit extension reads to render quota and balance information.

flowchart LR
 A[Claude Platform measurement] --> B[UsageStore]
 C[Display preferences] --> B
 B --> D[Shared balance resolver]
 D --> E[Widget snapshot JSON]
 E --> F[WidgetKit balance and quota views]
Loading

Technical review

Best possible solution:

Use the existing snapshot balance field and shared formatter while retaining grant quotas and honoring optional-credit visibility.

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

Fetched main excludes Claude Platform from both balance publication and rendering, establishing the reported omission directly from source without executing tests or probing an account.

Is this the best way to solve the issue?

The implementation uses the existing owners and format, preserves quota selection, and introduces no parallel balance calculation or setting.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a26ca57b5186.

Provenance checked

  • Widget balance publication and rendering keeps the original intent (e4fa9ca: Expose provider balances through an optional snapshot field without inventing quota bars or replacing real quota windows.)
  • Shared provider balance extraction keeps the original intent (cca269a: Keep amount extraction consistent between menu layouts and existing card/widget consumers.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c33760e adds Sources/CodexBar/UsageStore+WidgetSnapshot.swift:211 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c33760ecc34b; files: Sources/CodexBar/UsageStore+WidgetSnapshot.swift)
  • Nikolai Berezovskii: Raw commit e4fa9ca adds Sources/CodexBarWidget/CodexBarWidgetViews.swift:672 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e4fa9ca91518; files: Sources/CodexBarWidget/CodexBarWidgetViews.swift)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

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

  • Supply installed-widget evidence for balance rendering, retained grant quotas, and optional-credit visibility.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 27, 2026, 3:28 PM ET / 20:28 UTC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dex157

dex157 commented Nov 27, 2026

Copy link
Copy Markdown
Author

Widget render proof

The locally built widget extension is ad-hoc signed, so WidgetKit won't render it on this machine, and the app group belongs to the upstream team. Instead, these PNGs come from rendering the real UsageTile with ImageRenderer. The input is a WidgetSnapshot entry that UsageStore.persistWidgetSnapshot produced from a synthetic Claude Platform snapshot (two credit grants plus a $62.50 prepaid balance). The only difference between the two runs is the "show optional credits and extra usage" setting.

Medium, credits shown Medium, credits hidden
on off

The grant lanes stay as the headline, and the Balance row appears only when optional credits are visible. A small tile has room for one row, so it keeps the grant lane there ("+1 more"):

small

This PR's second commit (9f042ae) also makes Claude Platform selectable in the per-provider widgets. Before it, the plugin was only available in Burn Down, which has no balance row, so the balance couldn't show up anywhere.

🤖 Generated with Claude Code

Apply current prepaid-credit visibility to error-recovery projections while preserving quota readings and measurement time.

This branch has not been deployed

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

Labels

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal priority bug or improvement with limited blast radius. 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.

Widget: show Claude Platform prepaid credit balance in dollars

2 participants