You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Sub-agent dies with 'Network connection lost' during large tool call write — all work lost #43113
Sub-agents that accumulate large context (600K-800K+ tokens) during research-heavy tasks consistently die with "Network connection lost" when attempting to write large file content via the write tool. All work is lost — no partial results persisted.
Steps to reproduce
Spawn a sub-agent with a research-heavy task (e.g., "research X from primary sources and write a comprehensive report")
The agent does extensive web_fetch calls, accumulating 600K+ tokens of context
Agent attempts to write a large output file (10-20KB+) via the write tool
Connection drops mid-write with errorMessage: "Network connection lost."
No file is created, no partial output saved
Observed behavior
stopReason: "error" with errorMessage: "Network connection lost."
partialArgs shows the tool call started but never completed
Ideally: retry the write or checkpoint intermediate results
Environment
OpenClaw 2026.3.2
Provider: OpenRouter (anthropic/claude-opus-4.6)
macOS (arm64), local gateway mode
Happens consistently on sub-agents with 600K+ token context
Frequency
3/3 research-heavy sub-agents failed this way in one session. Short-context sub-agents (15-30K tokens) completed successfully.
Workaround
Split research tasks into two phases: (1) research agent saves raw notes to a file, (2) writer agent reads notes and compiles the final output. Keeps each agent's context small.
Closing this as duplicate or superseded after Codex automated review.
Close #43113 as duplicate/superseded by the newer open canonical issue #53540, which tracks the same large-context sub-agent/OpenRouter "Network connection lost" failure with stronger reproduction evidence. Current main has adjacent mitigations, but I did not find evidence that the exact reported streamed write-tool failure is fully fixed.
Adjacent main mitigation: large-context precheck: Current main performs pre-prompt context overflow checks and can route large contexts to tool-result truncation or compaction before submitting the prompt, but this is mitigation rather than proof that the reported transport drop during a streamed write tool call is fixed. (src/agents/pi-embedded-runner/run.ts:2510, e640c0a95fcb)
Activity
clawsweeper commentedon Apr 26, 2026
Closing this as duplicate or superseded after Codex automated review.
Close #43113 as duplicate/superseded by the newer open canonical issue #53540, which tracks the same large-context sub-agent/OpenRouter "Network connection lost" failure with stronger reproduction evidence. Current main has adjacent mitigations, but I did not find evidence that the exact reported streamed write-tool failure is fully fixed.
What I checked:
Network connection lostwhile streaming a largewritetool call, leaving no output file; the body links [Feature]: Sub-agent partial result persistence on timeout #37250 for partial persistence and [Bug]: Control UI hangs when WebSocket disconnects during long streaming responses #32400 for WebSocket disconnects.Network connection lost, zero tokens, and no output. [Bug]: Embedded runner "Network connection lost" when LLM generates a tool call with large parameters (param generation latency > underlying request timeout) #53540 adds stronger isolation evidence via successful curl/OpenAI SDK replay outside OpenClaw.src/agents/pi-embedded-runner/run.ts:2510, e640c0a95fcb)stopReason="error"plus zero-output cases when no side effects were recorded, but the guard is narrow and does not establish that [Bug]: Sub-agent dies with 'Network connection lost' during large tool call write — all work lost #43113's partial tool-call/write stream failure is resolved. (src/agents/pi-embedded-runner/run.ts:2088, e640c0a95fcb)src/agents/subagent-announce-output.ts:232, e640c0a95fcb)So I’m closing this here and keeping the remaining discussion on the canonical linked item.
Codex Review notes: model gpt-5.5, reasoning high; reviewed against e640c0a95fcb.