Skip to content

Fix Escalation

When the reviewer returns NEEDS_WORK, DevLoop loops back to the worker with a fix prompt. Most reviews land on round 1 or 2. The escalation strategy controls what happens when they don't.

Configure in devloop.config.sh:

DEVLOOP_FIX_STRATEGY=escalate     # default
DEVLOOP_MAX_FIX_ROUNDS=5          # default

escalate strategy (default)

Three phases, scaled to DEVLOOP_MAX_FIX_ROUNDS (N).

Phase 1 — Standard fix (rounds 1 to N/2)

The latest review is fed to the worker. Fast, focused, usually sufficient.

round 1  → worker reads: spec + latest review
round 2  → worker reads: spec + latest review

Phase 2 — Deep fix (rounds N/2 + 1 to N)

Every prior review is concatenated and injected so the worker can see why earlier attempts failed.

round 3  → worker reads: spec + review-1 + review-2 + review-3
round 4  → worker reads: spec + review-1..4
round 5  → worker reads: spec + review-1..5

This is the most effective single change for stubborn fixes — it gives the worker the failure pattern, not just the latest symptom.

Phase 3 — Re-architect (after N rounds)

The spec is regenerated by the architect with the full failure history as context. Then a fresh worker + reviewer cycle runs (capped at 2 attempts).

round N+1 → architect rewrites spec using failure context
          → worker implements new spec
          → reviewer evaluates

This is the escape hatch when the original spec was wrong. You can opt out per-run:

devloop run "..." --no-respec

standard strategy (legacy)

Hard cap: after N failed fix rounds, the pipeline exits with NEEDS_WORK and the latest review on disk. No deep fix, no re-architect.

Set:

DEVLOOP_FIX_STRATEGY=standard

Use this if you'd rather pause and review the situation yourself than have the architect retry.

Tuning

Variable Default Effect
DEVLOOP_MAX_FIX_ROUNDS 5 Total rounds before re-architect (or hard exit on standard)
DEVLOOP_FIX_STRATEGY escalate escalate or standard

If your team consistently lands fixes in 1-2 rounds, lower N to fail faster. If you're using a worker model that improves with more iterations, raise it.

Observability

Every fix round emits a phase event with the round number and strategy phase. You can see them in the dashboard, in devloop session <TASK-ID>, or in the raw event stream.

devloop stats     # avg fix rounds per task, % that reach re-architect

If most tasks need ≥3 rounds, your spec quality or worker model is the problem — not the fix loop. Promote lessons aggressively (devloop learn --global) so the architect learns from past failures.