on main help sign in
fix: race condition where title might not be generated (#1844)
87df08cChristian Rocha
internal/agent/agent.go+1−1
@@ -183,6 +183,7 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy
183 a.generateTitle(titleCtx, call.SessionID, call.Prompt)
183 a.generateTitle(titleCtx, call.SessionID, call.Prompt)
184 })
184 })
185 }
185 }
186+ defer wg.Wait()
186
187
187 // Add the user message to the session.
188 // Add the user message to the session.
188 _, err = a.createUserMessage(ctx, call)
189 _, err = a.createUserMessage(ctx, call)
@@ -491,7 +492,6 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy
491 }
492 }
492 return nil, err
493 return nil, err
493 }
494 }
494− wg.Wait()
495
495
496 if shouldSummarize {
496 if shouldSummarize {
497 a.activeRequests.Del(call.SessionID)
497 a.activeRequests.Del(call.SessionID)