Merge branch 'main' into worktree-agent-a7c8c1a6937e97e84
Resolve chat_room.go: keep main's bounded chatSub queue (ready channel, no ch) in attachSub; the subscribe live-turn marker is still queued at attach under h.mu through enqueueChatLocked, and an existing subscriber whose queue is full is overflowed (resync) after the hub lock is released. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/claude"
|
||||
"git.a-wan.net/alan/pipelines/internal/pipeline"
|
||||
"git.a-wan.net/alan/pipelines/internal/protocol"
|
||||
"git.a-wan.net/alan/pipelines/internal/stage"
|
||||
)
|
||||
|
||||
// When Claude Code refuses an operator chat's turn because the account ran
|
||||
@@ -288,10 +287,11 @@ func (h *chatHub) publishAutoSwitchNotice(ctx context.Context, refusal claude.Us
|
||||
}
|
||||
title := truncateUTF8("Switched "+name+" to "+singleLine(email)+" and continued", 256)
|
||||
message := "Claude usage ran out, so Pipelines switched the account and asked the agent to check it is on track before continuing."
|
||||
click, views := chatAttentionLinks(refusal.SessionID)
|
||||
click, _ := chatAttentionLinks(refusal.SessionID)
|
||||
id := "chat:" + refusal.SessionID + ":auto-switch:" + refusalKey(refusal)
|
||||
if h.notes != nil {
|
||||
h.notes.record(ctx, pipeline.AppNotificationRecord{
|
||||
AppNotification: protocol.AppNotification{ID: "chat:" + refusal.SessionID + ":auto-switch:" + refusalKey(refusal), Kind: protocol.NotificationChatReply,
|
||||
AppNotification: protocol.AppNotification{ID: id, Kind: protocol.NotificationChatReply,
|
||||
Title: title, Message: message, Click: click, Priority: chatAutoSwitchPriority, Tags: []string{}, Group: "chat:" + refusal.SessionID},
|
||||
SessionID: refusal.SessionID,
|
||||
})
|
||||
@@ -299,7 +299,5 @@ func (h *chatHub) publishAutoSwitchNotice(ctx context.Context, refusal claude.Us
|
||||
if !chatAttentionConfigured() || !chatNotificationSettings(ctx, h.settings).NtfyEnabled {
|
||||
return
|
||||
}
|
||||
if _, err := chatAttentionPublish(stage.WithNtfyPriority(ctx, chatAutoSwitchPriority), "system", title, message, "", nil, click, views...); err != nil {
|
||||
log.Printf("claude auto-switch notification session=%s: %v", refusal.SessionID, err)
|
||||
}
|
||||
h.pushChatNtfy(ctx, pipeline.ChatNotification{ID: id, SessionID: refusal.SessionID, Title: title, Body: message, Click: click, Priority: chatAutoSwitchPriority})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user