mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
Switching, adding, re-authing, or removing a Codex account awaited refreshForCodexAccountChange before resolving the IPC call. Since the per-account CODEX_HOME rollout (#9501) that probe runs against a cold home (10s RPC + 15s PTY fallback, 25s WSL) and can queue behind an in-flight global usage fetch, so the switcher sat unresponsive for tens of seconds and a fresh login looked stuck on the loading screen. Worse, in addAccount the awaited refresh sat inside the login cleanup try/catch: a refresh rejection after the account was durably committed deleted the just-created managed home, leaving a registered account with no home ("account never connects"). Run the refresh as best-effort background work instead. Its synchronous prefix still flips usage to "fetching" before the first await, so the switcher updates instantly and usage fills in via the normal rate-limit state pushes; a probe failure is logged and can never trigger managed-home cleanup. Fixes #10141