Skip to content

Fix Cursor pace detail when billing cycle quota is depleted - #1824

Merged
steipete merged 4 commits into
steipete:mainfrom
Yuxin-Qiao:fix/cursor-depleted-pace
Jul 2, 2026
Merged

Fix Cursor pace detail when billing cycle quota is depleted#1824
steipete merged 4 commits into
steipete:mainfrom
Yuxin-Qiao:fix/cursor-depleted-pace

Conversation

@Yuxin-Qiao

@Yuxin-Qiao Yuxin-Qiao commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Hide Cursor billing-cycle pace projection (deficit + run-out copy) once remainingPercent reaches zero.
  • Align Cursor with UsageStore.weeklyPace and CLI behavior so depleted quotas no longer show a misleading "Runs out now" / "即将耗尽" label.
  • Cursor-only diff: no workflow or unrelated automation changes.

Behavior proof (redacted)

Live CLI (CodexBarCLI usage --provider cursor, 2026-07-02)

== Cursor (web) ==
Total: 0% left [------------]
Resets Jul 4 at 11:06 AM
Auto: 0% left [------------]
Resets Jul 4 at 11:06 AM
API: 0% left [------------]
Resets Jul 4 at 11:06 AM

No pace / deficit / run-out lines are emitted for depleted lanes (matches CLI remainingPercent > 0 guard). Account/plan lines omitted from proof.

Menu model regression (swift test --filter CursorMenuCardModelTests)

✔ Test "cursor billing cycle metrics hide pace when quota is depleted" passed
✔ Test "cursor billing cycle metrics show deficit and run out details" passed
✔ Test "legacy request plan shows single requests bar with count" passed
✔ Test "team pool shows personal spend and changes height fingerprint" passed
✔ Test run with 4 tests in 1 suite passed

Depleted fixture asserts Total/Auto/API keep 0% left while detailLeftText, detailRightText, and pacePercent are all nil.

Test plan

  • swift test --filter CursorMenuCardModelTests (4/4)
  • make check
  • Live CLI proof above (0% remaining, no pace lines)
  • Menu model regression proof above
  • Optional reviewer UI spot-check in app menu (bars remain; pace detail hidden at 0%)

@clawsweeper

clawsweeper Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed July 2, 2026, 5:52 AM ET / 09:52 UTC.

Summary
The branch adds a Cursor menu-model guard to suppress billing-cycle pace detail at 0% remaining, adds a depleted-quota regression test, and records a changelog note.

Reproducibility: yes. from source inspection. Current main can compute weekly pace for a depleted Cursor billing-cycle window and render the weekly zero-ETA state as Runs out now, while the store and CLI paths already suppress depleted-window pace.

Review metrics: 1 noteworthy metric.

  • Diff surface: 3 files changed, +49/-1. The current head is narrowly scoped to one Cursor menu-model guard, one regression test, and one changelog note.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🦞 diamond lobster
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] Several GitHub CI jobs were still queued or in progress at the latest status read; that is ordinary branch-protection status, not a patch defect.

Maintainer options:

  1. Decide the mitigation before merge
    Land the focused guard and regression test after normal checks and maintainer merge review complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No ClawSweeper repair job is needed; the remaining action is normal maintainer merge review and branch-protection completion.

Security
Cleared: The diff only changes Swift menu-model logic, a focused test, and a changelog line, with no dependency, credential, CI, or supply-chain surface.

Review details

Best possible solution:

Land the focused guard and regression test after normal checks and maintainer merge review complete.

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

Yes, from source inspection. Current main can compute weekly pace for a depleted Cursor billing-cycle window and render the weekly zero-ETA state as Runs out now, while the store and CLI paths already suppress depleted-window pace.

Is this the best way to solve the issue?

Yes. Adding the remainingPercent > 0 guard inside cursorBillingCyclePaceDetail is the narrow maintainable fix and preserves non-depleted Cursor pace details with focused regression coverage.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 450ca4d91565.

Label changes

Label justifications:

  • P2: This fixes a contained user-visible Cursor quota display bug with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides redacted live Cursor CLI output for a depleted quota plus focused menu-model terminal output showing the patched depleted-lane behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides redacted live Cursor CLI output for a depleted quota plus focused menu-model terminal output showing the patched depleted-lane behavior.
Evidence reviewed

What I checked:

  • Repository policy read: AGENTS.md was read fully; its preference for focused model/CLI validation over live AppKit flows informed this review. (AGENTS.md:1, 450ca4d91565)
  • No maintainer notes present: The checkout only has .agents skills; there were no .agents/maintainer-notes files matching the touched Cursor model or test paths. (450ca4d91565)
  • Current-main source path still permits depleted Cursor pace: On current main, cursorBillingCyclePaceDetail guards the Cursor provider and window duration before computing pace, but does not guard remainingPercent > 0. (Sources/CodexBar/MenuCardView+ModelHelpers.swift:416, 450ca4d91565)
  • Why the current path renders misleading text: UsagePace.weekly sets etaSeconds to 0 when actual usage is at least 100%, and UsagePaceText renders weekly zero ETA as Runs out now. (Sources/CodexBarCore/UsagePace.swift:81, 450ca4d91565)
  • Existing alignment guard: UsageStore.weeklyPace already returns nil for windows with no remaining percent, which matches the behavior the PR brings to Cursor menu-card billing-cycle metrics. (Sources/CodexBar/UsageStore+HistoricalPace.swift:9, 450ca4d91565)
  • CLI alignment guard: The CLI pace computation also suppresses depleted windows with guard window.remainingPercent > 0, supporting the PR's stated consistency target. (Sources/CodexBarCLI/CLIRenderer.swift:476, 450ca4d91565)

Likely related people:

  • kmatsunami: The merge commit for fix(cli): show pace where it was missing — Session line, JSON output, and weekly work-day baseline #1722 is blamed for cursorBillingCyclePaceDetail, UsageStore weekly pace, UsagePaceText, and the CLI depleted-window guard used as alignment evidence. (role: introduced current helper and adjacent CLI pace path; confidence: high; commits: 5bfd1d1474bb; files: Sources/CodexBar/MenuCardView+ModelHelpers.swift, Sources/CodexBar/UsageStore+HistoricalPace.swift, Sources/CodexBarCLI/CLIRenderer.swift)
  • steipete: History shows steipete authored the earlier Cursor billing-cycle pace details commit and multiple weekly pace follow-up commits in the same behavior area. (role: original Cursor billing-cycle pace contributor and recent area contributor; confidence: high; commits: 91824283af5f, 2f92ee97e46e; files: Sources/CodexBar/MenuCardView+ModelHelpers.swift, Sources/CodexBar/MenuCardView.swift, Tests/CodexBarTests/CursorMenuCardModelTests.swift)
  • Yuxin-Qiao: Beyond this PR, prior merged work in fix(codex): correct historical pace run-out forecasts #1581 touched exhausted quota and run-out behavior in the pace model/tests. (role: adjacent pace exhaustion contributor; confidence: medium; commits: f986661480c7; files: Sources/CodexBar/HistoricalUsagePace.swift, Tests/CodexBarTests/UsagePaceTests.swift, Tests/CodexBarTests/UsagePaceTextTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@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: 04f5f1ff01

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

@@ -1,188 +0,0 @@
name: Monitor Upstream Changes

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 Restore the upstream monitor workflow

Deleting this file removes the only scheduled/manual GitHub Actions entry point for upstream checks, while the repo still documents using .github/workflows/upstream-monitor.yml and Actions → Monitor Upstream Changes in docs/FORK_SETUP.md and docs/UPSTREAM_STRATEGY.md. With this commit, maintainers no longer get the advertised upstream-sync issue updates unless the workflow is restored or the docs/scripts are updated to a replacement process.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added 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. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. labels Jul 1, 2026
@Yuxin-Qiao
Yuxin-Qiao force-pushed the fix/cursor-depleted-pace branch from 7795ceb to b0643a6 Compare July 2, 2026 04:24
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 automation 🚨 Merging this PR could break CI, automerge, proof capture, label sync, or automation. label Jul 2, 2026
@Yuxin-Qiao

Copy link
Copy Markdown
Contributor Author

Addressed ClawSweeper feedback:

  • Restored cursor-only scope on b0643a6e (no upstream-monitor.yml deletion).
  • Added redacted live CLI output and menu-model test proof to the PR body.
  • Local validation: CursorMenuCardModelTests 4/4 pass, make check pass.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 2, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. 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. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 2, 2026
@steipete
steipete merged commit bf86b09 into steipete:main Jul 2, 2026
10 checks passed
@steipete

steipete commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Landed as bf86b09e634c33f330fbd4df329f3a2e7b8449e3.

Proof on exact PR head 6850e41fac311aac4f5cb9360368e24b9b7df95a:

  • swift test --filter CursorMenuCardModelTests — 4/4 passed, including fully depleted Total/Auto/API quota cases
  • make check — passed
  • make test — all 45 shards passed
  • exact-head GitHub checks — 10/10 successful
  • autoreview — clean, no actionable findings

Reviewed the contributor's live menu proof. The bounded fix now suppresses pace/run-out details only when the Cursor billing-cycle quota is fully depleted; normal nonzero quota behavior remains covered. Thanks @Yuxin-Qiao!

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: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants