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:
2026-12-01 00:23:43 +00:00
parent 1995382e8c
commit ed9072b79a
30 changed files with 1362 additions and 21 deletions
+8
View File
@@ -77,6 +77,14 @@ func admitChatPrompt(ctx context.Context, request protocol.Message, broker chatB
hub.attach(prompt.SessionID, clientID, sanitizeChatClientLabel(prompt.Client), broker, write)
_ = write(protocol.Message{Type: protocol.ChatPrompt, ID: request.ID, ChatQueued: queued, ChatSteered: steered})
return
} else if hub.autoContinueSuperseded(prompt.SessionID, operationID) {
// The server already continued this refusal on another Claude account:
// acknowledge the auto-continue and take it straight back out, as if
// another device had unchecked it.
hub.attach(prompt.SessionID, clientID, sanitizeChatClientLabel(prompt.Client), broker, write)
_ = write(protocol.Message{Type: protocol.ChatPrompt, ID: request.ID, ChatQueued: true})
hub.fanoutQueue(prompt.SessionID, protocol.ChatQueueFrame{Removed: operationID})
return
}
attachmentFiles, attachmentParts, err := prepareChatAttachments(prompt.SessionID, prompt.Attachments)
if err != nil {