From 87df08c4088afb265a3886380db96ca6387c518d Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Tue, 13 Jan 2026 11:29:21 -0500 Subject: [PATCH] fix: race condition where title might not be generated (#1844) --- internal/agent/agent.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/agent/agent.go b/internal/agent/agent.go index 8d2fa40fd427143bf988587ef7faa3a89c3e23b1..198159d53adbcbba8f8598bf24a8eef55825acfc 100644 --- a/internal/agent/agent.go +++ b/internal/agent/agent.go @@ -183,6 +183,7 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy a.generateTitle(titleCtx, call.SessionID, call.Prompt) }) } + defer wg.Wait() // Add the user message to the session. _, err = a.createUserMessage(ctx, call) @@ -491,7 +492,6 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy } return nil, err } - wg.Wait() if shouldSummarize { a.activeRequests.Del(call.SessionID)