on main help sign in
fix(agent): make sure we finish thinking on error
commit2313d9cbfda42d93453b71cd8a9ead5f9cbbfd99 authorKujtim Hoxha <kujtimii.h@gmail.com> dateMon 20 Oct 2025, 11:12 (1 year ago) parent0ba17e8
1 file changed+2
internal/agent/agent.go+2
internal/agent/agent.go+2
@@ -351,6 +351,8 @@ func (a *sessionAgent) Run(ctx context.Context, call SessionAgentCall) (*fantasy
351351 if currentAssistant == nil {
352352 return result, err
353353 }
354+ // Ensure we finish thinking on error to close the reasoning state
355+ currentAssistant.FinishThinking()
354356 toolCalls := currentAssistant.ToolCalls()
355357 // INFO: we use the parent context here because the genCtx has been cancelled
356358 msgs, createErr := a.messages.List(ctx, currentAssistant.SessionID)