Repository navigation
Chats follow an account switch for worker results too - #37126
Conversation
…sends Chat option reads, model-list reads and every send resolved the selected Claude account through the router's synchronous state-file read. Route them through an async twin that shares the same login cache. A relaunch for a removed account no longer prepares (and recreates) its folder.
A coordinator chat that had started any worker kept answering every message on the account it used before a switch, until every worker it started finished and every result was read. Every new turn, including a worker's result, now launches on the selected account. A reply already running finishes where it started, and a chat whose own background work is still running keeps its process until that work ends. This removes the per-account result tracking that held the old account (the parent-work query, the response index and its queued and usage-limit carve-outs, the input account recipe on the startup attempt, and the read-only journal restore that only fed it), plus the journal index and change-feed fields only it read. A relaunch can no longer prepare, and so recreate, a removed account's folder. The record still saves the account each launch actually ran on, for Session History.
…choice, next to a user's message
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
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. |
…the expected homes without a shared object
Review loop status: done on the headThe problem. Since #30955, a coordinator Claude chat that had started any Orca worker ignored a Claude account switch: every message, and every worker result, kept running on the old account until all of its workers had finished and every result had been read. That could be hours, or forever for a stuck worker. Users who switched because the old account hit its usage limit kept getting answers from the account they left. Two smaller problems sat in the same code: a worker result arriving after the old account was removed recreated that account's folder (or failed with "not signed in"), and every chat read and send read the account's state file synchronously on the main thread. What changes for users. After a Claude account switch, a coordinator chat's next message and any worker result that arrives later run on the newly selected account, also after quitting and reopening Orca. A reply already running finishes where it started. A removed account's folder is never recreated. The account check before chat reads and sends no longer blocks the main thread on the state file, and chats checking at once share one read. Codex chats are unchanged. Fixed during review
Deferred (P3, none worse for users than main)
Verified
Not verified
For Brennan's review
Where judgment matters:
Pending with Brennan (Decision 8): whether a worker's result should instead stay on the account that started the worker. This PR is built as "follow the switch". |
Problem
Since #30955, a coordinator chat that has started any worker ignores a Claude account switch. Every message the user types keeps running on the old account until every worker it started has finished and every result has been read. That can take hours, and a worker stuck open holds the chat on the old account forever. A user who switched because the old account hit its usage limit, or to separate work and personal use, keeps getting answers from the account they left.
Two smaller problems sit in the same code:
What changes for users
After switching Claude accounts, a coordinator chat's next message, and any worker result that arrives later, run on the newly selected account. A reply already running finishes on the account it started on. A chat whose own background tasks are still running keeps its current process until they finish, as before. A removed account's folder is never recreated. The account check that runs before every chat read and send no longer reads the account's state file in a way that blocks the main thread, and chats checking at the same time share one read. Starting a new Claude process (the first message, after the chat was closed, or after a restart) can still read that file in a blocking way while preparing the launch, as before.
Codex chats are unchanged: they stay on the account they were started with.
How
prepareClaudeLaunchAccount). This removes Open chats move to the account you switch to, before their next message #30955's per-account result tracking: the parent-work query, the native response index, its queued and usage-limit carve-outs, the input account recipe on the startup attempt, and the read-only journal restore that existed only to feed it.acquiredAccount), which Session History shows. Nothing reads it to choose an account any more.claudeRoutedHomeAsync). It shares the same login cache, and chats reading at the same time share one read of the state file. Preparing a new Claude process (first message, after the chat was closed, or after a restart) can still read the file synchronously, as before, and terminal launches keep the sync read.Differences from the common pattern
Tests
Tracked in STA-13191.