Deliverable Planner: Fails with “max turns” or 600s Timeout
Status: ✅ Fixed (2026-05-05) — requires strategy re-approval to test
Severity: Was Critical — deliverable plan never generated; all retries exhausted
File: packages/agents/src/workers/strategy.worker.ts
Symptom
The deliverable planner job fails in multiple ways across successive retries:
ERROR [strategy-worker] Deliverable planner job failed
message: "Reached maximum turns per run" ← ~6-8 min runs (with tools or with max_turns:1)
ERROR [strategy-worker] Deliverable planner job failed
message: "Process timed out after 600s" ← ~10 min runs (generation too slow)The plan is never created. The onboarding flow stalls after strategy approval.
Root Cause (Confirmed — Three Combined Issues)
Issue 1: Missing allowedTools: []
The config was missing allowedTools: []. With --dangerously-skip-permissions and no --allowed-tools restriction, Claude had full access to all tools. Claude used tools during generation (browsing CWD), then needed turn 2 to continue after the tool result, which was blocked by maxTurnsPerRun: 1.
Fix: Added allowedTools: [] to disable all tool use. This resolves the spurious error_max_turns from tool use.
Issue 2: maxTurnsPerRun: 1 blocks legitimate multi-turn output
The deliverable planner generates large JSON (goals + deliverables + action items + planning notes). The JSON is too long to fit in a single Claude response. The Claude Code CLI tries to do a continuation (turn 2), which is blocked by --max-turns 1.
Fix: Raised maxTurnsPerRun: 1 → maxTurnsPerRun: 3.
Issue 3: 600s timeout insufficient for large prompts
The prompt includes the full strategy document (~20K chars) + full client context (~30-50K chars). With this large input, Claude Sonnet 4.6 takes 3-4 min per turn × 3 turns = 9-12 min. The 600s (10 min) timeout fires before the generation completes.
Fix: Raised timeoutSec: 600 → timeoutSec: 900 (15 min) and lockDuration: 720_000 → lockDuration: 1_080_000 (18 min).
Fix Applied
// strategy.worker.ts — execute config
config: {
cwd,
model: "claude-sonnet-4-6",
dangerouslySkipPermissions: true,
allowedTools: [], // pure generation — disable all tool use
timeoutSec: 900, // 15 min — large input requires more time
maxTurnsPerRun: 3, // 3 turns: allows long JSON output to span continuations
}
// strategy.worker.ts — Worker config
lockDuration: 1_080_000, // 18 min (15 min timeout + 3 min buffer)How to Test
After an agents server restart:
- Go to the dashboard → Strategy page for the test tenant
- Admin approves the strategy document
- Watch
logs/agents-restart.logforDeliverable planner job completed - Check the dashboard for the generated goals and deliverable plan
The job that exhausted retries on 2026-05-05 CANNOT be retried automatically. It requires re-approval of the strategy document to trigger a new enqueue.
Related
insight-worker-base.tswas fixed at the same time (maxTurnsPerRun: 1 → 3) for the same continuation issue.- Both require an agents server restart to take effect.