Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 2.84 KB

File metadata and controls

20 lines (13 loc) · 2.84 KB

Runtime Rotation

Bugfixes

  • Fixed a stale-runtime recovery deadlock that returned a permanent 503 "All managed Codex accounts are temporarily unavailable for this runtime request." even when accounts were healthy and doctor passed. Per-account transient state (coolingDownUntil, cooldownReason, rateLimitResetTimes) is serialized into the V3 snapshot, so recoverStaleRuntimeState's loadFromDisk() restored the same state that had wedged the pool, while the recovery guard refused to run whenever any account's skip reason was "rate-limited" or "cooling-down*". The guard now suppresses recovery only on "policy-blocked" (external, unchanged by a reload), and recoverStaleRuntimeState calls AccountManager.clearAccountTransientState() then flushPendingSave() before publishing the reloaded manager, so the cleared snapshot survives a restart within the debounce window. The two halves are coupled — each is pinned by a regression test that fails if the other is reverted (#606, #607).
  • Fixed the missing-accountId cooldown branch in runRotationLoop not persisting its mutation. When resolveAccountId returned null the branch called markAccountCoolingDown but — unlike every sibling cooldown branch (network-error, 429, server-error, 401 invalidation) — never called saveToDiskDebounced(), so a restart inside the 30s window dropped the cooldown and immediately re-selected the still-broken account. Added the missing persist (#608).
  • Fixed the short-retry 429 path in the runtime fetch loop not persisting its rate-limit window. The branch mutated the disk-serialized rateLimitResetTimes via markRateLimitedWithReason, then slept and retried without a saveToDiskDebounced(), unlike the full-rotation branch beside it; a crash during the retry sleep lost the reset time. Added the missing persist (#609).

Testing

Improvements

  • Added regression coverage for all three durability fixes: clearAccountTransientState unit tests (cooldown clear, rate-limit clear incl. future windows, mixed state, no-op on empty pool, flush-backed persistence); all-cooling-down pool recovers to 200 while policy-blocked pools still suppress recovery; missing-accountId and short-retry branches each assert saveToDiskDebounced is scheduled. Each fix's test fails if its source change is reverted (verified by mutation).

Notes

  • Stable release published under the latest dist-tag (npm i -g codex-multi-auth).
  • All three fixes share one root-cause class: transient account state is persisted to disk, so any path that mutates it must schedule a write or a restart silently drops it. All mutation sites were audited; these were the gaps.
  • The codex-multi-auth rotation reset-rate-limits command remains available as a manual escape hatch.
  • Promotes the 2.3.0-beta line to stable; all fixes from 2.3.0-beta.12.3.0-beta.3 are included.