Chat: the server continues a usage-refused Claude chat at the reset
When Claude Code refuses an operator chat's turn for a usage limit and the server does not continue it on another account, the server now queues a durable prompt (auto-continue-<refusal id>, sent as Pipelines (automatic)) for a minute after the reset: the refused operator message when the turn did no work, else "continue". The reset comes from the refusal's text, else the rejected rate_limit_event. Refusals of turns Claude Code started itself are handled too, with no client attached; a restarted server or a device scheduling the same refusal adds nothing. The choice is kept per Claude home beside auto-switch (or by the server for chats without one), read and set with chat_auto_continue, on by default. The app's limit banner now finds the refusal as the latest turn, ignoring notices, agent reports and activity rows after it, reads and writes the server's choice, and only schedules its own prompt for older servers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,3 +65,27 @@ type ClaudeAccountList struct {
|
||||
// home to another saved account and continues the chat automatically.
|
||||
AutoSwitch bool `json:"auto_switch"`
|
||||
}
|
||||
|
||||
// ChatAutoContinueType reads (AutoContinue nil) or sets the "Auto-continue
|
||||
// when limits reset" choice that applies to a chat: when a usage limit
|
||||
// refuses one of its turns, the server queues a prompt to send a minute after
|
||||
// the reset. The choice is kept per Claude home (beside auto_switch) for a
|
||||
// chat whose directory selects one, else by the server for every other chat;
|
||||
// it is on by default. The reply carries the current choice.
|
||||
const ChatAutoContinueType = "chat_auto_continue"
|
||||
|
||||
// Scopes of a ChatAutoContinue reply.
|
||||
const (
|
||||
ChatAutoContinueClaudeHome = "claude_home"
|
||||
ChatAutoContinueServer = "server"
|
||||
)
|
||||
|
||||
// ChatAutoContinue is the chat_auto_continue body and reply.
|
||||
type ChatAutoContinue struct {
|
||||
SessionID string `json:"session_id"`
|
||||
// AutoContinue is the new choice of a request (nil reads it) and the
|
||||
// current choice in the reply.
|
||||
AutoContinue *bool `json:"auto_continue,omitempty"`
|
||||
// Scope says where the choice is kept: claude_home or server (reply).
|
||||
Scope string `json:"scope,omitempty"`
|
||||
}
|
||||
|
||||
@@ -256,6 +256,8 @@ type Message struct {
|
||||
// ClaudeAccounts their reply (claude_accounts.go).
|
||||
ClaudeAccount *ClaudeAccountRequest `json:"claude_account,omitempty"`
|
||||
ClaudeAccounts *ClaudeAccountList `json:"claude_accounts,omitempty"`
|
||||
// ChatAutoContinue is the chat_auto_continue body and reply.
|
||||
ChatAutoContinue *ChatAutoContinue `json:"chat_auto_continue,omitempty"`
|
||||
// ModelRequest is the chat_model body and echoed selection.
|
||||
ModelRequest *ChatModelRequest `json:"chat_model,omitempty"`
|
||||
// ChatModes is the chat_modes reply: the permission modes the session's
|
||||
|
||||
Reference in New Issue
Block a user