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
🐛 mocactl subagents shows a misleading failed: fetch failed for any leaf that runs longer than 5 minutes #515
mocactl spawn's detached worker holds a synchronous POST /v1/runs until the server finishes the run. That fetch (LeafTransport.submitLeafTurn in packages/mocactl/src/transport/leaf-turn.ts) sets no timeout, so it inherits undici's default headersTimeout of 300s. Any leaf whose turn runs longer than five minutes is cut off client-side, and the worker writes a terminalfailed / fetch failed to the ledger (runSpawnWorker in packages/mocactl/src/subagent.ts).
The server-side run is unaffected — it completes and stores its result, and mocactl get collects it (responded, exit 0). But because terminal ledger states are sticky, mocactl subagents reports failed: fetch failed forever for a run that succeeded. Observed on mocactl edge-a02b9db / Node 24: a leaf that completed at ~10.5 minutes still shows failed in subagents; the ledger flip happened at exactly ~301s after dispatch, twice.
Steps To Reproduce
mocactl spawn "Run 'sleep 400' and then reply done." --kind prompt --tag repro --json
Watch the ledger at ~/.local/state/mocactl/subagents.jsonl: at ~301s the entry flips to "lastKnownState":"failed","stateDetail":"fetch failed", and mocactl subagents shows failed.
Keep polling mocactl get <sessionId> --json: at ~400s it prints "status":"responded" and writes the result files (exit 0). The run succeeded — only subagents is wrong.
Expected Behavior
mocactl subagents should not report a terminal failed for a run that is still executing, or that completed, server-side. Either the worker's fetch should not time out at five minutes (an explicit AbortSignal.timeout, or an undici Agent with a headersTimeout matching the server's 24h result TTL), or a worker-side fetch error should not be recorded as a terminal state — the entry should stay non-terminal and reconcile against /runs/status, which subagents and get already query.
Activity
pdettori commentedon Oct 14, 2026
thanks @maia-iyer - would you like to submit a PR for this issue ?