2.0 KiB
Agent Dispatch Pre-flight
When this applies
Before starting /loop ... /orchestrate, /dispatch, or any unattended or overnight agent batch. Run this checklist once, before the loop starts — not mid-run.
Checklist — all must pass before the loop starts
-
CP reachable.
curl -fsS "$CP_URL/health"returns 200.CP_URLis defined inclaude/agent-runtimes-cp.md— read that file for the correct value and any auth headers required. -
A dispatcher is polling. Check the CP dispatchers endpoint (see
agent-runtimes-cp.md). A queued task with no live dispatcher sits forever — confirm at least one dispatcher is active before queuing work. -
Scaffolding present.
.agent-tasks.jsonexists and passesjq empty .agent-tasks.json(valid JSON).- All templates, repos, and input files referenced by tasks are resolvable from this host.
- Agent push keys are loaded (
ssh-add -l) — container agents push branches back; a missing key silently fails the push.
-
Auth done this session.
CLAUDE_CODE_OAUTH_TOKENis set in the environment or readable from~/dev/claude/secrets/claude/long_lived_oauth_token. Confirm before launching containers.
Do not start the loop until all four pass. Surface any failure to the user and wait for remediation.
Circuit-breaker
Track task-state changes across invocations. After 5 consecutive invocations with no state change (no task moved from pending→running, running→completed/failed, etc.): stop dispatching, print a stuck-queue report listing each task and its current status, and wait for the user. Never run an unattended loop without this guard.
Recovery
If a dispatch batch needs to be aborted mid-run:
- Drain queued tasks: set pending tasks to
cancelledin.agent-tasks.jsonbefore the next invocation so the orchestrator does not launch them. - Let running containers finish or
docker stopthem explicitly. - Re-dispatch from a clean state once the root cause is resolved.