Repository navigation
Fix unified Cursor/Grok additional spend - #4593
Conversation
Replace the obsolete legacy request-quota lookup for unified personal memberships with the dashboard monthly billing endpoint. Keep quota and identity available when optional billing fails, and retain team and ordinary membership paths. Verified with 18 focused tests across three suites and make check.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR reads unified personal Cursor/Grok monthly additional spend from the current billing endpoint while preserving summary data as a fallback. Example: A unified Ultra account has used 93 cents of a 1000-cent monthly allowance.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a demonstrated billing-display bug still present on main, follows the owner's fallback direction, and has no identified correctness blocker. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Cursor status probe fetches authenticated account usage and projects it into the shared UsageSnapshot consumed by the CLI, app, and widgets. flowchart TD
A[Existing Cursor session] --> B[Cursor status probe]
B --> C[Usage summary and weekly allowance]
B --> D[Optional personal monthly billing]
C --> E[Usage snapshot projection]
D --> E
E --> F[CLI app and widgets]
Technical reviewBest possible solution: Land the focused optional billing lookup with its validated monthly projection and preserved summary fallback. Do we have a high-confidence way to reproduce the issue? The captured affected-account responses, 0.77.0 CLI result, and current-main summary projection establish the false-zero path; no target code was executed during this review. Is this the best way to solve the issue? The existing probe and snapshot projection are the appropriate owners, and the patch replaces only the irrelevant personal legacy lookup while retaining team behavior and failure fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c286d3428cd8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 19, 2026, 3:11 AM ET / 07:11 UTC (Revision 2). |
|
Thanks @yazcaleb. We couldn't get a real response from an affected account, and the synthetic fixtures don't establish how the new personal billing endpoint marks membership, which fields are cents, or when the monthly period resets. As written, the change also removes the existing summary spend and caps whenever the new optional read is unavailable. If you can, please share a sanitized response from that endpoint for an affected account (field names, units and reset fields kept; identifiers and tokens removed). With that we can finish this in place and keep the existing spend data as the fallback. |
Retain summary spend, caps, and reset when optional unified billing is unavailable or invalid, as requested in PR 4593. Include sanitized affected-account responses, dashboard proof, stable/fixed CLI comparison, and stored-snapshot compatibility coverage. Validation: 36 tests in five focused suites; make check; live fixed CLI matches dashboard at $0.93/$10. Regression checks fail on the original PR revision. Installed app and existing configuration remain unchanged.
Keep only the optional monthly response in the snapshot and enforce personal billing scope when parsing the summary. Cover zero-spend precedence and rejection of personal billing for team budgets. Validation: 36 focused tests; make check; live CLI reports $0.93/$10 with existing settings unchanged.
|
Thanks, captured this from my affected personal Ultra account on October 19. The same session's usage summary reports
{
"availability": "available",
"monthlyUsage": {
"usedCents": 93,
"limitCents": 1000,
"creditsUsedCents": 0,
"periodStart": "2026-10-01T00:00:00.000Z",
"resetsAt": "2026-11-01T00:00:00.000Z"
}
}The dashboard shows $0.93 of $10, resetting November 1. Membership comes from the usage summary; the monthly response has no membership field. Credit consumption was zero, so nonzero credit behavior remains synthetic coverage. Fixed the fallback as requested: failed or invalid monthly billing retains the summary's spend, cap, and reset. The installed 0.77.0 CLI reports Sanitized responses, dashboard screenshot, CLI output, and stored-data compatibility proof. All 36 focused tests and @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Read the personal monthly billing response for unified user-scoped accounts. Keep the summary spend, cap, and reset when the optional response is unavailable, incomplete, malformed, or outside its billing period. Preserve weekly usage and account identity, and keep credit consumption separate from additional spend. Share the existing HTTP request and decoding path instead of adding duplicated fetch plumbing. Remove committed proof artifacts and retain fixture coverage. Also carry the behavior-preserving TypeSafe cleanup needed for strict lint. Co-authored-by: Yaz <yecyec0606@gmail.com>
# Conflicts: # CHANGELOG.md
|
Merged in 36a37fe, thanks @yazcaleb, and for capturing the real Ultra response! Unified Ultra accounts with a user-level limit now show monthly spend, cap and reset from that endpoint, and if it's ever unavailable the existing summary values stay in place instead of disappearing. It will ship in the next release. |
…Pi) (#963) * Follow the active claude-swap slot in Auto Claude usage Auto `usage --provider claude` now answers from the active claude-swap slot when the integration is enabled, instead of whichever browser or CLI login the ordinary source order finds. Explicit --source, --account, --all-accounts and a configured non-auto usage source bypass it. If the adapter fails or the active slot has no usable usage (live for ok or unavailable rows, last-good otherwise), the ordinary sources run and the source label gains " (claude-swap fallback)" or " (tcr fallback)". Inactive slots are never borrowed. The projection now keeps the live measurement time (usageFetchedAt). * Read Claude limits entry by entry for OAuth and Web A malformed limits entry used to fail the whole array on both the OAuth and Web paths, which dropped valid model-scoped weekly rows. Entries are now read field by field: a field of the wrong type reads as missing, a non-object entry is skipped, a non-array limits value reads as empty, and a JSON Boolean is never a percentage. The OAuth response shares the same deserializer, so both paths parse limits identically. Upstream steipete#4614, refs steipete#4126. * Use monthly spend for unified Cursor personal accounts Unified personal Cursor memberships read monthly additional spend from the usage-status endpoint. A valid response supplies spend, cap and reset; an unavailable, malformed or out-of-period response keeps the usage-summary values. Team budgets and other plans are unchanged. Upstream steipete#4593. * Honor the configured OpenCode Go source with a manual cookie A manual cookie used to force the web source for OpenCode Go, so a configured Auto or Local source was ignored. A new provider hook, manual_cookie_keeps_usage_source, lets the shell keep the configured source when the provider offers it. Other providers keep the Web route. Upstream steipete#4616. * Prefer ordinary Gemini quota buckets for the Antigravity summary The Antigravity quota summary now represents Gemini with the ordinary gemini-5h (or session alias) and gemini-weekly buckets, matched by normalized ID rather than label. A model-specific Gemini allowance represents Gemini only when the ordinary bucket of that cadence is absent, unknown or disabled. All buckets stay visible as extra windows. Upstream: CodexBar steipete#4659 (389d287). * Scan larger Antigravity local histories Raise the aggregate local-history scan bounds to 100,000 rows, 512 MiB of attempted payload and 30 seconds. Per-file, per-record and schema bounds and cancellation are unchanged. Adds regression coverage for history beyond the former 50,000-row cap. Upstream: CodexBar steipete#4639 (5818152). * Accept catalog provider IDs in the --provider flag Add a regression test that every catalog ID reported by config providers --format json selects that same provider. The behavior already held on Windows; the test keeps it from regressing (upstream steipete#4643). * Report OpenCode Go local cost history in the cost command codexbar cost --provider opencodego read no local history and reported local cost scanning as unavailable. It now reads recorded OpenCode Go usage for the selected window (upstream steipete#4606). Known gap: unknown-token presentation and the per-model token breakdown are not ported. The shared CostSummary cannot show unknown tokens, so incomplete token sums are shown as zero. * Keep unsupported Pi backends as unpriced standalone history Pi/OMP rows from backends without native pricing are kept in standalone Pi history as unpriced tokens labeled backend/model. They never borrow native Codex or Claude prices. Native Codex and Claude scans skip these rows without losing completeness. Malformed rows from unsupported backends mark only standalone history incomplete. Missing timestamps still keep standalone history incomplete (upstream steipete#4628, fixes steipete#4605). * Retrigger CI --------- Co-authored-by: Factory Agent <agent@factory.dev>
Fix additional-spend reporting for unified personal Cursor/Grok accounts. The affected account's dashboard shows $0.93 / $10, while the installed 0.77.0 CLI reports $0 / $10. The rebuilt CLI matches the dashboard.
Read monthly billing with the existing session, convert cents to dollars, and retain its reset date. If the optional read fails or returns invalid data, keep the summary's spend, cap, and reset. Valid monthly data takes precedence, including zero spend and an unlimited cap. Team and legacy-account paths stay unchanged.
The billing read replaces the legacy request-quota lookup for unified personal accounts: four requests per successful refresh, with the existing five-second optional request budget. No new polling or persisted schema changes.
Sanitized live responses, dashboard screenshot, CLI comparison, and compatibility proof.
Validation:
make checkpassed.Live credit consumption was zero; nonzero credit isolation is covered synthetically. The installed app was not replaced; GUI upgrade testing and full-suite CI remain outstanding.