Repository navigation
Honor inactive Claude account retry deadlines - #26936
Conversation
Retain classified OAuth rate-limit deadlines and last-good usage in each inactive account cache, then skip automatic requests until that account is eligible. Preserve healthy sibling refreshes and current forced refresh policy. Partially addresses #26588. Co-authored-by: Tauri-EPO <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Automatic refreshes of inactive Claude accounts now respect an active server-requested retry deadline, while healthy accounts keep refreshing. No merge-blocking risk was identified in the supplied changes. Pre-merge checks |
|
Keep current profile-router usage reads and the shared OAuth error metadata. Adapt the inactive-account regression fixtures to the installed profile router; preserve each account's server retry gate and healthy sibling refreshes.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1546c0db-50fb-4d34-aa63-507a543e0dbe
📒 Files selected for processing (3)
src/main/rate-limits/claude-managed-usage-credential-source.test.tssrc/main/rate-limits/service-inactive-claude-cooldown.test.tssrc/main/rate-limits/service/service-inactive-accounts.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Keep the existing per-account deadline filter and current execution-host profile router while verifying the current main source.
Exercise numeric and HTTP-date waits through the real local HTTP service, independent account expiry and invalid headers. Guard fixture cleanup when setup fails.
ELI5
Opening the Claude account switcher should respect one account’s server-requested wait while still updating other accounts.
What Changed
Automatic inactive-account refreshes now check that account’s existing retry deadline before sending a request or showing a fetching state. Recent usage and its original timestamp stay available; healthy accounts continue updating, and the blocked account becomes eligible at the exact deadline.
Usage continues through the current profile router and shared OAuth fetcher. Manual Refresh and account-change refresh keep their existing forced-attempt behavior.
Why
The shared fetcher already returns a 429’s retry deadline, but the inactive-account loop ignored it. Reopening the switcher after its 60-second debounce could send another request during a one-hour server wait. Reusing the existing per-account cache and deadline check fixes that loop without adding another retry policy or persistent cache.
Linked Issue
Partially addresses #26588: automatic retries for inactive accounts. Keep the issue open for its broader expectations, including manual force and state after restarting.
Visual Proof
The current profile-router regression uses owned synthetic accounts, the actual service and shared fetcher, and a real local HTTP server. Replacing only the inactive-account loop with
mainreproduces these request counts:At A’s exact deadline, A becomes request 3 and B becomes request 4. A’s last-good quota timestamp stays unchanged while blocked. No real account, Keychain or Anthropic endpoint was used.
The original recorded-request attachment below is from commit
27da87f; the current profile-router tests reproduce the same counts. These are tables rendered from request records, not application screenshots. No rendered retry-countdown or native WSL execution is claimed.Original standalone before/after request evidence.
Before — original recorded service HTTP requests
After — original recorded service HTTP requests
Testing
Verified PR-head checks, pinned main b3aa719, October 10: 100 tests across eight suites pass at
1d5fe2023c95d40827a4a331867c6ea26ecfbf92, which normally mergesb3aa719a57ca7f5b8fe7db38abf3e9dc4b58a4bb. Production remains the same per-account deadline filter. Added HTTP-date, independently expiring account waits and invalid-header controls; guarded fixture cleanup addresses the valid bot finding. Removing the filter produces four expected request-count failures in the same fixture. Forced refresh, healthy accounts, last-good usage, expiry, account removal and stop controls remain covered. Host/WSL metadata controls mock routing and credential observation; they do not runwsl.exe.A separate native macOS Electron 43.7.5 probe passes seven transport checks using the production OAuth parser and proxy implementation, real Chromium
net.fetch, and an allowlisted local TLS endpoint through a local CONNECT proxy. It verifies seconds/date headers, caller cancellation and the unchanged ten-second timeout, with response closure, zero windows and complete owned-process/socket cleanup. No real account/provider endpoint was contacted. This transport proof does not exercise rendered account selection or the inactive-account service filter; the service fixtures above cover that policy.Node, CLI and web typechecks, the canonical changed-code quality gate, all seven full-file quality configurations, formatting and diff checks pass. Tests and the no-window app use
ORCA_BACKGROUND_LAUNCH=1and owned temporary data. Local macOS validation read existing locked dependencies through an isolated overlay without installation, shared rebuilding or tracked configuration changes.Fresh Linux verification of this exact source passes all 100 tests/eight suites on Linux x64 Node 24.21.0, using installed Electron in RunAsNode mode without an app/window. Its final replay excludes the shared cache and uses a new explicit owned transform cache; the exact source passes again. Fresh Windows x64 Node 24.18.0 passes 92 of 100 tests, including all 12 deadline/loopback cases; its eight failures match the exact pinned-baseline Windows titles and error classes, with no new failure. Those are existing Windows preview policy, path and PTY/Fable expectations; no full Windows green claim is made.
The initial Windows run unexpectedly triggered a borrowed Electron dependency's installer during import, adding donor files that remain preserved. Initial native overlays also linked shared Vitest caches on both hosts. Changing the Windows Electron link to an owned copy then caused 12 fixture transport failures before HTTP arrival; the fresh capsule with a sealed Electron copy and a new explicit owned transform cache passes all 12 again. This supports a stale module-resolution cache explanation; the failed runs remain evidence and are not hidden. Final runs disable installation and leave the preserved donor cache untouched. Earlier native results apply only to original
27da87f: Linux 59 cases/six suites and Windows 58 with one unchanged baseline assertion. They are historical evidence, not the current source's native result.Ordinary CI is green at
1d5fe2023c95d40827a4a331867c6ea26ecfbf92: 14 successful and 16 skipped contexts, with no failed or pending checks. The valid bot cleanup thread is resolved after source and primary-error preservation review.Review
Final merge verification: #26936 is merged as
a09dc9aa7143e70300b012fe92486dc7478bb4d1, with the authentic Tauri-EPO co-author footer recognized by GitHub. Before merge, the two PR regression suites and newer ZCode service controls passed 21 tests across three files on the composed main04f8f2b5tree96d0cb29. Main advanced during merge only in eight separate cloud/relay files (#27048). The actual squash parent isfda01fac, tree1c0bd72e; all 13 frozen source/test/config/build objects remain identical, so the scoped service proof transfers. Root verified all 23 artifacts and confirmed that the squash changes exactly the three reviewed PR paths. No native or transport rerun is claimed. Final exact-head CI had 14 successful/16 skipped contexts; complete bot comments and the resolved cleanup finding were checked before the ordinary squash.Reviewed commit:
1d5fe2023c95d40827a4a331867c6ea26ecfbf92; pinned mainb3aa719a57ca7f5b8fe7db38abf3e9dc4b58a4bb. Root reviewed the complete filter and adapted fixtures, the added deadline controls, the bot cleanup repair and normal main integration. The final PR changes one production filter and two regression files. The execution host owns the service and account cache; no renderer gate, new RPC, durable state or transport policy was added.Agent skill upstream boundary
Notes
The original fix commit retains
Co-authored-by: Tauri-EPO <[email protected]>for its adapted classifier work. Its direct credential-reading implementation is superseded by the current shared fetcher. No code from #26589 was retained.Checklist