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:
2026-12-03 01:11:11 +00:00
150 changed files with 7656 additions and 901 deletions
+12 -3
View File
@@ -141,6 +141,7 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
// Prompts queued behind a running turn are durable and owned by their
// session; resume delivering any a previous process left queued.
hub.queueStore = stores[0]
hub.startChatNotificationOutbox(ctx, stores[0])
hub.liveStore = stores[0]
hub.turnDiffStore = stores[0]
}
@@ -282,8 +283,11 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
// A chat search runs beside the read loop so its transcript readback
// never delays the run search sent with it; a newer one cancels the
// previous, whose reply the client would discard as stale anyway.
// A newer chat search replaces an older one of the same mode: the
// chat list's search and a find-in-chat search never cancel each other.
cancelChatSearch := func() {}
defer func() { cancelChatSearch() }()
cancelScopedChatSearch := func() {}
defer func() { cancelChatSearch(); cancelScopedChatSearch() }()
// Keystrokes and sizes take their own lane (terminal_lane.go), so
// they never wait behind a slow request read before them. The lane
// is drained before the deferred detaches above run.
@@ -309,9 +313,14 @@ func HandlerWithOptions(ctx context.Context, options Options, stores ...*pipelin
continue
}
if isChatSearch(request) {
cancelChatSearch()
searchCtx, cancel := context.WithCancel(connCtx)
cancelChatSearch = cancel
if scopedChatSession(*request.Search) != "" {
cancelScopedChatSearch()
cancelScopedChatSearch = cancel
} else {
cancelChatSearch()
cancelChatSearch = cancel
}
go func(request protocol.Message) {
defer cancel()
_ = write(chatSearchReply(searchCtx, request, options.Chat, registry))