fix: use non-cancellable context for reasoning goroutine

The reasoning content goroutine was using the turn-scoped context
which gets cancelled when the turn ends, racing with the publish.
Use context.WithoutCancel to ensure reasoning is delivered.

Also fix gci field alignment and golines indentation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-03-26 01:20:13 +09:00
parent d8a18daa11
commit ed23705af1

View file

@ -1068,7 +1068,12 @@ func (al *AgentLoop) runLLMIteration(
if reasoningText == "" { if reasoningText == "" {
reasoningText = response.ReasoningContent reasoningText = response.ReasoningContent
} }
go al.handleReasoning(ctx, reasoningText, opts.Channel, al.targetReasoningChannelID(opts.Channel)) go al.handleReasoning(
context.WithoutCancel(ctx),
reasoningText,
opts.Channel,
al.targetReasoningChannelID(opts.Channel),
)
logger.DebugCF("agent", "LLM response", logger.DebugCF("agent", "LLM response",
map[string]any{ map[string]any{