Skip to content

Don't treat a refused fast mode as the session's usage limit - #958

Merged
hardbeat920 merged 1 commit into
hardbeat920:mainfrom
zcy22606:fix/fast-mode-credits-not-usage-limit
Oct 14, 2026
Merged

hardbeat920 merged 1 commit into
hardbeat920:mainfrom
zcy22606:fix/fast-mode-credits-not-usage-limit

Conversation

@zcy22606

@zcy22606 zcy22606 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

What changed

usageLimitFromRateLimitEvent returns null for a rejected rate_limit_event whose rateLimitType is overage, so a session no longer shows the usage-limit notice ("continue after reset") when only fast mode's extra-usage credits are exhausted.

Why

With extra-usage credits used up, Claude Code reports a rejection for the credit pool that fast mode bills to:

{ "status": "rejected", "rateLimitType": "overage", "overageStatus": "rejected",
  "overageDisabledReason": "out_of_credits", "isUsingOverage": false,
  "resetsAt": 1793491200 }

resetsAt is the monthly credit reset, weeks out. Claude Code itself drops to standard speed and the plan keeps serving the session, but usageLimitFromRateLimitEvent treated any rejection that wasn't paid by extra usage as a plan limit, so the app paused the queue and offered to continue after that far-off reset.

Plan windows (five_hour, seven_day, …) and events without a rateLimitType behave as before. Only the overage window is excluded, rather than allowlisting known plan windows, so a plan window added later still stops the session.

UI

No layout changes. The usage-limit notice no longer appears when only fast mode's credits run out.

Validation

  • New test in claudeProtocol.test.ts with the event above; it fails on main. The existing five_hour and extra-usage tests still pass.
  • npm run check:web: vitest (5285 passed, 13 skipped) and tsc --noEmit. No Rust changes.

Checklist

  • I ran npm run check (check:web; no Rust files changed)
  • This PR is small and focused
  • I did not mix unrelated changes

Summary by CodeRabbit

  • Bug Fixes
    • Corrected usage-limit handling for rejected extra-usage events, preventing them from being reported as a usage limit when the turn continues under the plan.

With extra-usage credits used up, Claude Code's rate_limit_event comes
back rejected with rateLimitType "overage": the credit pool fast mode
bills to, resetting at the monthly cycle. Claude Code drops to standard
speed and the plan keeps serving the session, but the app took any
rejection as a plan limit and offered to continue after a reset weeks
away.

Ignore a rejection whose window is the overage pool, the same way an
event is already ignored while extra usage is paying for the turn.
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d43afcbe-aa5b-4d81-bc49-acaffb3e8f22
📥 Commits

Reviewing files that changed from the base of the PR and between 226ec5b and 524708b.

📒 Files selected for processing (2)
  • src/integrations/harness/providers/claude/claudeProtocol.test.ts
  • src/integrations/harness/providers/claude/claudeProtocol.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

The Claude usage-limit check now returns null for rejected overage rate-limit events. A test covers the out-of-credits case.

Changes: Claude overage rate-limit handling

Layer / File(s) Summary
Ignore rejected overage events
src/integrations/harness/providers/claude/claudeProtocol.ts, src/integrations/harness/providers/claude/claudeProtocol.test.ts
usageLimitFromRateLimitEvent ignores rejected events with rateLimitType set to "overage". A test verifies that an out-of-credits rejection returns null.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: hardbeat920

Merge Risk: ⚪ Minimal · up to 52470

The change ignores refused fast-mode overage events to avoid showing a misleading plan-limit notice. No supported merge-blocking risk remains in the reviewed scope.

Pre-merge checks · Passed 5
Passed Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejected fast-mode overage events no longer count as the session usage limit.
Description check Passed The description includes all required sections, explains the change and rationale, documents the UI impact, and provides a completed checklist. It also includes relevant validation results.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hardbeat920

Copy link
Copy Markdown
Owner

@zcy22606 nice fix! merging

@hardbeat920
hardbeat920 merged commit 0abb2c8 into hardbeat920:main Oct 14, 2026
13 checks passed
zcy22606 added a commit to zcy22606/monocode that referenced this pull request Oct 17, 2026
Brings in upstream 633730d..8e4da94: resumed sessions no longer end a
turn early on a replayed background-task notice, skills survive a UTF-8
cut at the 16 KiB prefix, quoted Git diff paths, a blank session keeps
its project's account, question / approval sounds, clickable terminal
links, remembered Preview / Source choice, project group reordering,
compact rail tooltips, Vue / Svelte / Sass / Less / .env highlighting,
Mono activity as an overview tab and the inline Mono intro card. Includes
our upstreamed fixes hardbeat920#880, hardbeat920#883, hardbeat920#884, hardbeat920#958, hardbeat920#975 and hardbeat920#985.

Adds upstream's @xterm/addon-web-links, @codemirror/lang-less,
@codemirror/lang-sass, @codemirror/lang-vue and
@replit/codemirror-lang-svelte dependencies.

Conflicts:
- App.tsx (hardbeat920#880), claudeProtocol.ts (hardbeat920#958), ProjectRail / MonoRailSection
  group-has-[button:focus-visible] (hardbeat920#985): take upstream's version of our
  fixes; drop our duplicate SOL-77 test and the stale focus-within notes.
- Sidebar: upstream's rail tooltips with our i18n.
- MonoIntro, MonoOverview: take upstream and re-translate; accept the
  MonoActivityPanel deletion.
- GitChangesPanel, MarkdownModeToggle: keep i18n, take upstream's styles.

Translated the new upstream UI (monos, shell, sessions, settings).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants