Skip to content

Key Claude OAuth rate-limit backoff per seat - #403

Open
tsouth89 wants to merge 1 commit into
mainfrom
cursor/sbs-1064-oauth-backoff-per-seat-c0f5
Open

Key Claude OAuth rate-limit backoff per seat#403
tsouth89 wants to merge 1 commit into
mainfrom
cursor/sbs-1064-oauth-backoff-per-seat-c0f5

Conversation

@tsouth89

@tsouth89 tsouth89 commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Summary

Claude OAuth RATE_LIMIT_BACKOFF_UNTIL was a single process-wide Instant. A 429 on one directory seat paused every other Claude seat in the same process, including seats that only share a login email across orgs.

Backoff is now keyed by the same directory-seat identity used for account isolation and post-SBS-1057 predictive pace (dir_key of CLAUDE_CONFIG_DIR). Ambient None resolves to the CLI's current config dir so an explicit ambient path is the same seat.

two_directory_seats_do_not_share_oauth_rate_limit_backoff failed on the process-global gate with:

a 429 on one directory seat must not pause the other

and passes after the keyed map.

Related issue

Fixes SBS-1064

Affected areas

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Documentation
  • Other:

Validation

Hosted CI passed on this branch (Frontend, Rust / shared, Rust / desktop, required Rust aggregator, CodeQL).

Local Linux cloud agent:

  • cargo fmt --all --check
  • cargo test --manifest-path rust/Cargo.toml — 1188 lib + 32 bin tests passed, including the new two-seat isolation tests
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings — failed on pre-existing Linux-only unused items in secure_file.rs / updater.rs (Windows-gated). Hosted Windows clippy passed.
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml — missing gdk-3.0 locally. Hosted Windows desktop job passed. Desktop crate was not changed.
  • Frontend — unchanged; hosted Frontend job passed
  • scripts\local-check.ps1 — PowerShell, not available here

UI / tray proof

  • Not applicable
  • Visual proof attached
  • Visual proof was not practical; manual validation and explanation attached

Notes for reviewers

Sibling process-global OAuth / rate-limit sweep:

  • RATE_LIMIT_BACKOFF_UNTIL was the only process-global Instant gate in Claude OAuth.
  • REFRESHED_CREDENTIALS is already keyed by CredentialSource (file path / env / keyring).
  • Token refresh (oauth/refresh.rs) has no backoff gate.
  • Claude web/admin fetchers have no process-global 429 gate.
  • No other provider owns a similar process-global RATE_LIMIT_BACKOFF_UNTIL.

Do not merge; this PR is for review.

Open in Web Open in Cursor 

Note

Track Claude OAuth rate-limit backoff per seat instead of globally

  • Changes RATE_LIMIT_BACKOFF_UNTIL from OnceLock<Mutex<Option<Instant>>> to OnceLock<Mutex<HashMap<String, Instant>>> keyed by a canonicalized config-directory identity.
  • Adds rate_limit_seat_key to resolve the seat key from the fetcher's explicit config_dir or the ambient Claude config dir, using dir_key for canonicalization (trailing separators stripped, lowercased on Windows).
  • Updates fetch_usage, record_rate_limit, clear_rate_limit, and rate_limit_backoff_remaining to operate on per-seat entries rather than a single global timer.
  • Risk: paths that differ only by trailing separators (or case on Windows) now share the same backoff entry; reviewers should check dir_key in account_dirs.rs to confirm the canonicalization matches all caller expectations.

Macroscope summarized a36ae64.

SBS-1064: a 429 on one directory seat no longer pauses other Claude
accounts via a process-global RATE_LIMIT_BACKOFF_UNTIL instant.

Co-authored-by: Tyler <tyler@southboundsoftware.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 50 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c4a657a-2014-4661-a4e4-b3ac385c9072

📥 Commits

Reviewing files that changed from the base of the PR and between 5bae231 and a36ae64.

📒 Files selected for processing (2)
  • rust/src/core/account_dirs.rs
  • rust/src/providers/claude/oauth/mod.rs

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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ceiling a36ae64 Commit Preview URL

Branch Preview URL
Aug 23 2026, 10:25 PM

@tsouth89
tsouth89 marked this pull request as ready for review August 23, 2026 22:29
@cursor

cursor Bot commented Aug 23, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_f72ba099-4502-41b8-a0a2-83bc7783087e)

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