Skip to content

fix(claudeplatform): preserve balance when credit details overflow - #5115

Open
Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:work/claude-platform-credit-detail-limit-5094
Open

Yuxin-Qiao wants to merge 1 commit into
steipete:mainfrom
Yuxin-Qiao:work/claude-platform-credit-detail-limit-5094

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

If a Claude Platform wallet has more than 24 additional credit grants, its detail section exceeds the plugin host's row limit and the whole balance refresh fails. Keep all details at the limit. When grants exceed the limit, show 23 in expiry order plus an omitted count. The total wallet balance, subscription and purchased credit windows, and monthly spend remain available.

Related to #5094.

Validation

  • Replayed synthetic wallet responses through the bundled plugin runtime in QuickJS and JavaScriptCore. With 24 extra grants, both versions return the wallet. With 25 or 200, the base rejects the snapshot and the patch returns the expected balance, credit windows, spend, and omitted count in both engines.
  • ./Scripts/test_fast.sh --jobs 6 -Xswiftc -gnone --filter 'ClaudePlatformPluginTests|CostUsageStoreReadWorkTests|SpendDashboardSnapshotBackedRevisionTests' passed. The new wallet regression passed all six cases.
  • make check passed.
  • ./Scripts/test.sh --direct-workers 8 passed all 168 groups on the first run, with zero retries or timeouts. Test discovery used the same local Swift build flags.

CLI behavior with an isolated wallet fixture

Ran local builds using the normal codexbar usage --provider claudeplatform --source web --json entry point against the base (1f6da9bec444) and PR head (feb4131e3718). A test-only transport supplied synthetic Console responses for the organization, credits, and spend requests. Outbound network and Keychain access were disabled. Both QuickJS and JavaScriptCore produced the same results. The rows below are a sanitized excerpt of the CLI's output and exit status.

Additional grants Base exit PR exit Wallet balance on PR Subscription used Purchased credits used Monthly spend Grant details on PR
24 0 0 $199 25% 50% $43.21 24 rows
25 1, details[0].rows exceeds 24 entries 0 $200 25% 50% $43.21 23 rows + 2 not shown
200 1, same row-limit error 0 $375 25% 50% $43.21 23 rows + 177 not shown

@clawsweeper

clawsweeper Bot commented Nov 18, 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 18, 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-11-18T10:42:04.881547Z feb4131 PR opened
ℹ️ 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR bounds Claude Platform grant details to 24 rows and shows an omitted count when the wallet contains more grants.

Example: A Claude Platform wallet has a $200 balance and 25 additional credit grants.

  • Before: The host rejects the entire snapshot because the detail section exceeds 24 rows.
  • After: The balance, subscription and purchased-credit windows, and monthly spend remain available alongside 23 grant rows and “2 not shown”.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with meaningful boundary coverage and supplied CLI evidence using isolated wallet fixtures.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The updated body records the normal codexbar usage entry point on pinned base/head builds with isolated synthetic Console responses in both engines: 24 grants remain complete, while 25 and 200 recover from base validation failures and retain balances, credit windows, spend, and correct omitted counts.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A wallet with many additional credit grants fails to refresh any balance information.
Reason: The patch completely addresses its stated overflow bug within the existing provider, preserving established defaults and calculations; the broader related feature request remains separate.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current snapshot-validation failure with a focused change; no actionable defects remain, and the updated CLI evidence addresses the previous proof request.

Priority: P2
Reviewed head: feb4131e3718b59f1ab3987f5de90ed02ec77097

Before merge

None.

Findings

None.

Agent review details

How this fits together

The bundled Claude Platform plugin converts Console billing responses into a shared usage snapshot that the Swift host validates for app and CLI consumption.

flowchart LR
  A[Console billing responses] --> B[Claude Platform plugin]
  B --> C[Balance and credit windows]
  B --> D[Bounded grant details]
  C --> E[Host snapshot validation]
  D --> E
  E --> F[App and CLI output]
Loading

Technical review

Best possible solution:

Land the bounded detail-list repair while preserving existing wallet calculations, expiry ordering, and the host’s snapshot limits.

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

Current main maps every additional grant into one section, which the host rejects above 24 rows; supplied base/head CLI results corroborate this path, and no target code was executed during review.

Is this the best way to solve the issue?

Bounding presentation in the existing provider is the smallest complete repair: it respects the documented host contract, preserves numeric wallet data, and explicitly counts omitted details.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Claude Platform grant details and documentation changes intended behavior with a stated reason (9d34800: Expose Console prepaid balance, expiring grants, and optional spend separately from Claude subscription usage.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 556b359 adds docs/claudeplatform.md:42 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 556b359bef8c; files: docs/claudeplatform.md)

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 proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Wallets with more than 24 additional grants lose their entire balance snapshot; the failure is confined to this provider and input shape.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-18T10:52:34.897Z sha feb4131 :: needs real behavior proof before merge. :: none

Reviewed November 18, 2026, 9:03 AM ET / 14:03 UTC (Revision 2).

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Nov 18, 2026

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

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant