Skip to content

Subagents complete analysis but fail to write artifact files #105

Description

@williamthorsen

Problem

During orchestrated runs, subagents complete their analysis work (many tool calls, full codebase exploration) but fail to write their output artifact file. The orchestrator records these as phase failures because it cannot find the expected artifact.

This occurs in 50-75% of reviewer dispatches. In one run, 3 of 4 reviewers failed; in another, 4 of 10 subagent dispatches produced no output.

Root cause

Subagents exhaust their `max_turns` budget doing analysis and get cut off before reaching the artifact-write step, which is the last action in their workflow.

Contributing factors:

  1. `max_turns` is too low for typical analysis workload (aspect reviewers at 15 turns are especially tight)
  2. The write step has no safety net — it's the last action in a linear pipeline, so it's always the first thing dropped when turns run out
  3. No budget awareness — agents have no visibility into their turn count and cannot self-regulate
  4. No efficiency guidance — agents dutifully read every changed file in full, even when the diff shows nothing relevant to their scope

Evidence

Agent Tool uses max_turns Outcome
`aspect-silent-failure-reviewer` 13 15 Succeeded
`aspect-code-reviewer` 25-33 15 Failed
`aspect-test-reviewer` 22-29 15 Failed
`orchestrated-reviewer` 42 30 Failed

The one agent that consistently succeeds (`aspect-silent-failure-reviewer`) has the narrowest scope and uses the fewest turns.

Impact

  • False `needs_manual_review` outcomes when all successful reviewers converge at `none`/`low`
  • Lost analysis work — findings from failed agents are not captured
  • Wasted compute — full turn budget consumed with no output

Proposed solution

Four independent safeguards (defense-in-depth):

  1. Turn-budget awareness (all 10 subagents): Add `## Turn budget` section stating exact turn count and a HARD-GATE to reserve last 3 turns for artifact writing
  2. Write-early pattern (4 reviewer agents): Restructure Process sections to write the artifact after initial analysis, before deep refinement — ensures partial output survives turn exhaustion
  3. Efficiency guidance (3 reviewer agents): Diff-first approach, batch reads, skip irrelevant files
  4. Moderate `max_turns` increase (3 aspect reviewers): 15 → 20 in frontmatter, SKILL.md table, and review-cycle dispatch

Acceptance criteria

  • All 10 subagent definitions include a `## Turn budget` section with correct turn count
  • All 4 reviewer agents use the write-early process pattern
  • 3 reviewer agents (code, test, core) have efficiency guidance
  • Aspect reviewer `maxTurns` updated to 20 in frontmatter, SKILL.md table, and review-cycle.md dispatch
  • Turn counts in `## Turn budget` sections match `maxTurns` frontmatter values
  • Turn budget table in SKILL.md matches all subagent frontmatter values

Files changed

File Changes
`content/subagents/aspect-code-reviewer.md` All 4 safeguards
`content/subagents/aspect-test-reviewer.md` All 4 safeguards
`content/subagents/aspect-silent-failure-reviewer.md` Safeguards 1, 2, 4
`content/subagents/orchestrated-reviewer.md` Safeguards 1, 2, 3
`content/subagents/orchestrated-architect.md` Safeguard 1
`content/subagents/orchestrated-planner.md` Safeguard 1
`content/subagents/orchestrated-coder.md` Safeguard 1
`content/subagents/plan-reviewer.md` Safeguard 1
`content/subagents/plan-reviser.md` Safeguard 1
`content/subagents/planner.md` Safeguard 1
`content/skills/orchestrate/SKILL.md` Safeguard 4 (table update)
`content/skills/orchestrate/modules/review-cycle.md` Safeguard 4 (dispatch update)

Related

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions