Claude accounts: switch a chat refused for usage to another saved account and continue it
When Claude Code refuses an operator chat's turn for a usage limit, the server marks the refused account until its reset and, if the chat's Claude home allows it (claude_account_auto_switch / `pipelines claude-account auto on|off`, on by default, kept in pipelines-accounts/settings.json), switches the home to the saved account with the most usage left through the claude_account_use path. Switches of one home are serialized, so chats refused together switch once. Each refused chat gets one queued prompt, marked as sent automatically, that asks the agent to check it is on track before continuing; the app's auto-continue-at-reset prompt for the refusal is removed (and refused if it arrives later), and the operator gets a low-priority notification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+26
@@ -571,6 +571,32 @@ The same operations run locally with
|
||||
[--dir DIR] [--json]`, which resolves DIR's (default: the current directory's)
|
||||
environment the way the server does.
|
||||
|
||||
Automatic switching: when Claude Code refuses an operator chat's turn because
|
||||
its account ran out of usage (the synthetic `rate_limit` assistant message and
|
||||
its is_error result, "You've hit your … limit"), the server marks that account
|
||||
as out of usage until its reset (from the rejected `rate_limit_event`, else its
|
||||
exhausted windows, else one hour) and, if the chat's Claude home has another
|
||||
saved account that is not known to be exhausted, switches the home to it
|
||||
through the `claude_account_use` path (lowest known usage first; an account
|
||||
with no known quota after those). Refusals of one home are serialized, so
|
||||
chats refused together switch once and each gets its own prompt. It then
|
||||
queues into the chat, behind the refused turn, a prompt sent as
|
||||
`Pipelines (automatic)` and starting `[Sent automatically by Pipelines]` that
|
||||
names both accounts and asks the agent to check its progress against the
|
||||
request and its plan, and to stop and ask if it is off track, before it
|
||||
continues. The app's `auto-continue-<refusal id>` prompt for that refusal is
|
||||
removed from the queue (and refused if it arrives later), and the operator gets
|
||||
a low-priority notification "Switched <chat> to <email> and continued". Each
|
||||
refusal switches at most once; a refusal of the new account tries the next
|
||||
untried account; with none left nothing more happens and auto-continue at the
|
||||
reset applies. It is on by default and is a per-Claude-home choice kept in
|
||||
`<config dir>/pipelines-accounts/settings.json`: `claude_account_auto_switch`
|
||||
(body `claude_account: {"session_id", "auto_switch": bool}`) sets it, every
|
||||
`claude_accounts` reply reports it as `auto_switch`, and
|
||||
`pipelines claude-account auto on|off` sets it locally. Pipeline stage runs are
|
||||
not switched: a stage refused for usage fails with the provider-quota error and
|
||||
its run stops.
|
||||
|
||||
The brokered OpenCode chat exposes the operator's own sessions, separate from the
|
||||
sessions pipeline runs create. The protocol types are:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user