From e6b3ef4f7353c77750f8d910860a5b774645a8cd Mon Sep 17 00:00:00 2001 From: wizardchen Date: Wed, 24 Jun 2026 00:15:58 +0800 Subject: [PATCH] fix(im): unblock agent stream wait when QA fails before complete event Close completeDone on pipeline errors and AgentQA early failures so handleMessageStream and runQA do not hang waiting for EventAgentComplete. --- internal/im/service.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/im/service.go b/internal/im/service.go index a1d81fce..aad24f9a 100644 --- a/internal/im/service.go +++ b/internal/im/service.go @@ -1931,6 +1931,7 @@ func (s *Service) handleMessageStream(ctx context.Context, msg *IncomingMessage, qaErr = fmt.Errorf("QA pipeline error: %s", data.Error) bufMu.Unlock() closeDone() + closeComplete() return nil }) @@ -2102,6 +2103,7 @@ func (s *Service) handleMessageStream(ctx context.Context, msg *IncomingMessage, qaErr = fmt.Errorf("QA execution error: %w", err) bufMu.Unlock() closeDone() + closeComplete() } }() @@ -2252,6 +2254,7 @@ func (s *Service) runQA(ctx context.Context, session *types.Session, query strin qaErr = fmt.Errorf("QA pipeline error: %s", data.Error) answerMu.Unlock() closeDone() + closeComplete() return nil }) @@ -2328,6 +2331,7 @@ func (s *Service) runQA(ctx context.Context, session *types.Session, query strin qaErr = fmt.Errorf("QA execution error: %w", err) answerMu.Unlock() closeDone() + closeComplete() } }()