Merge branch 'worktree-agent-a717651aa412e3b7c'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -286,8 +286,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.
|
||||
@@ -313,9 +316,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))
|
||||
|
||||
Reference in New Issue
Block a user