Workflow: schema-forced custom agentType can end its turn with prose and stall silently (no per-generation watchdog)
Summary
When a Workflow agent() call combines agentType (a plugin-defined subagent whose system prompt instructs it to answer in prose) with schema (StructuredOutput forcing), the subagent can finish the task inside extended thinking and then end its turn with a short prose message instead of calling StructuredOutput. The workflow surfaces no error and no result; the stage never completes. The only way to diagnose is manually reading the agent transcript jsonl under the workflow's transcript directory.
Environment
- Claude Code 2.1.215 (VS Code extension entrypoint), macOS (darwin 25.5.0)
- Model: claude-fable-5
Repro sketch
- Write a Workflow script with an
agent()call that setsagentTypeto a plugin agent whose definition says results are returned as reply text (e.g. a persona documented as "returns proposals with rationale" in the reply). - Give that call a heavy single-shot synthesis task: large JSON input (~90 KB in the prompt) and a
schemademanding a structured payload of a few thousand tokens. - Run the workflow.
Observed (twice, across a stop/resume of the same run):
- Attempt 1: a 218k-char thinking block (~13 min), then a second 163k-char thinking block (~10 min) that re-derived the same work, then a ~700-char prose summary of the finished result. No StructuredOutput call, no journal event, no error.
- The schema retry loop re-entered the same thinking marathon instead of escalating or failing.
- Lighter calls with the same
agentType+schemacombination (small inputs) complied fine, so the failure is load-dependent and intermittent.
Expected
- If a schema-forced agent ends a turn without the StructuredOutput call, surface it: a journal warning event, and a failed call after N retries, rather than silent identical retries.
- A per-generation watchdog (or configurable timeout) for workflow agents; a 20+ minute single generation with no transcript activity is indistinguishable from progress from the outside.
- Optionally: escalate the appended StructuredOutput instruction on retry (or inject it at a higher-priority level), since a plugin persona's own output contract can win over the appended instruction under heavy reasoning load.
Workaround that resolved it
Dropping agentType (using the default workflow subagent) for schema-forced synthesis stages, slimming the JSON input, and splitting the monolithic output into plan/write/patch stages. Same task then completed in ~4 minutes per stage.
3 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Follow-up with additional data from the same session: the thinking-marathon component reproduces with the DEFAULT workflow subagent as well (no custom agentType involved).
So two distinct failure modes: (1) the prose-exit is specific to custom agentType prompts whose own contract says "answer in the reply"; (2) the unbounded-thinking stall under schema + large input reproduces regardless of agent type, and a reasoning-effort cap is an effective mitigation. This strengthens the case for a per-generation watchdog and for surfacing thinking-only turns that end without the forced tool call.
The conflict between agentType system prompt instructions ("return as reply text") and the schema enforcement is a real trap. The agent faithfully follows its persona definition, the schema caller expects a structured call, and neither side surfaces an error - the stage just stalls.
Two workarounds that help while this is unresolved:
The underlying issue - that agentType definitions and schema requirements can silently conflict - is worth flagging as a documentation gap even before the code fix lands. The schema parameter on agent() should probably warn at call time if the target agentType's definition does not include explicit structured output instructions.