From d33ad4028bbff21ca422bcc7dcf07de1b629e3f9 Mon Sep 17 00:00:00 2001 From: Ed Zynda Date: Wed, 22 Apr 2026 13:06:37 +0300 Subject: [PATCH] fix(kit): enable streaming for subagent child instances - Set Streaming: true in subagent childOpts to prevent viper.Set("stream", false) from polluting global state - Without this, concurrent subagents and the parent could read stale stream=false from viper, causing provider-level issues (e.g. Anthropic non-streaming timeouts with extended thinking) --- pkg/kit/kit.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/kit/kit.go b/pkg/kit/kit.go index 0e945e7d..ca72f768 100644 --- a/pkg/kit/kit.go +++ b/pkg/kit/kit.go @@ -1781,12 +1781,19 @@ func (m *Kit) Subagent(ctx context.Context, cfg SubagentConfig) (*SubagentResult // Create child Kit instance. Pass the parent's loaded MCP config to // avoid re-reading viper (which races with concurrent subagent spawns). + // Streaming must be explicitly enabled — Options.Streaming defaults to + // false, and New() unconditionally writes viper.Set("stream", opts.Streaming). + // Without this, the subagent would (a) pollute viper global state for + // other concurrent callers and (b) potentially hit provider-level + // differences (e.g. Anthropic non-streaming timeouts with extended + // thinking). childOpts := &Options{ Model: model, SystemPrompt: systemPrompt, Tools: tools, NoSession: cfg.NoSession, Quiet: true, + Streaming: true, MCPConfig: m.mcpConfig, } child, err := New(ctx, childOpts)