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:
@@ -42,6 +42,9 @@ type chatManager struct {
|
||||
closed bool
|
||||
cache map[string]string // session id -> backend
|
||||
hinted map[string]bool // sessions whose directory was given to a chatDirectoryHinter
|
||||
// onRefusal receives Claude Code's usage-limit refusals
|
||||
// (chat_auto_switch.go); guarded by mu.
|
||||
onRefusal func(claude.UsageRefusal)
|
||||
}
|
||||
|
||||
// harnessProbeInterval bounds how often a missing harness is probed again, so
|
||||
@@ -158,6 +161,9 @@ func (m *chatManager) harness(backend string) chatBroker {
|
||||
m.codex = client
|
||||
} else {
|
||||
m.claude = client
|
||||
if source, ok := client.(chatRefusalSource); ok && m.onRefusal != nil {
|
||||
source.OnUsageRefused(m.onRefusal)
|
||||
}
|
||||
}
|
||||
m.mu.Unlock()
|
||||
if m.started {
|
||||
|
||||
Reference in New Issue
Block a user