Workflow subagent hangs indefinitely after degenerate API response (stop_reason=null); no retry, no error propagation

Open 💬 1 comment Opened Jul 8, 2026 by HappyEureka

Workflow subagent hangs indefinitely after degenerate API response (stop_reason=None); no retry, no error propagation

Environment

  • Claude Code 2.1.202, entrypoint claude-desktop, macOS (darwin 25.5.0)
  • Model: claude-fable-5 (session model), workflow subagent via the Workflow tool

What happened

A Workflow script called agent(prompt, {schema}) where the prompt was large
(~124KB: a JSON blob of audit findings to consolidate) and the schema forced a
StructuredOutput tool call. The subagent transcript shows:

  • 06:26:59Z user prompt delivered (124,189 bytes)
  • 06:33:13Z a single assistant message: output_tokens: 2, ONE empty

thinking block (length 0), NO tool_use, and stop_reason: null
(stream ended abnormally, not a normal stop)

  • afterwards: no further transcript activity of any kind for 4.5+ minutes,

until the parent stopped the task manually (TaskStop)

Expected

Per the Workflow tool docs, either:

  1. schema validation happens at the tool-call layer and the model retries when

the required StructuredOutput call is missing, or

  1. on terminal failure the agent() promise resolves to null so the script

can handle it.

Actual

Neither: after the degenerate assistant turn the subagent made no retry,
raised no error, and never resolved -- the workflow blocked at that agent
indefinitely. The parent workflow showed the phase as simply in-progress with
no indication of the wedged state.

Impact / workaround

Any workflow with a schema'd agent can stall forever on one abnormal stream
termination. Workaround used: TaskStop the run, replace the step, resume with
resumeFromRunId (cached agents replayed correctly -- that part worked well).

Suggested fix

Treat an assistant turn with stop_reason: null (or missing the required
schema tool call) as a retryable failure with a bounded retry count, then
resolve agent() to null -- matching the documented contract. Surfacing
retry state in /workflows progress would also help diagnosis.

Repro pointers (local to reporter's machine)

  • Run ID: wf_197b26bc-a0e (session 037ff65b-442e-4869-991f-0fefd2e4a30e)
  • Wedged subagent transcript: subagents/workflows/wf_197b26bc-a0e/agent-a613eed7d7a31803d.jsonl
  • The oversized-prompt pattern reproduces the stress, though the abnormal

stream end is presumably nondeterministic.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗