orchestrate: add dispatch pre-flight gate and 5-iteration stall circuit-breaker
This commit is contained in:
@@ -28,6 +28,19 @@ You are the task orchestrator. Check task state, update statuses, and launch con
|
||||
|
||||
If the task state file doesn't exist, say "No .agent-tasks.json found. Run /decompose first." and stop.
|
||||
|
||||
### Step 0: Dispatch pre-flight (first invocation only)
|
||||
|
||||
On the very first invocation of a dispatch session, run the pre-flight checklist from `~/dev/claude/claude/agent-dispatch-preflight.md` before proceeding. All four checks must pass:
|
||||
|
||||
1. CP reachable — confirm the health endpoint returns 200 (see `claude/agent-runtimes-cp.md` for `CP_URL`).
|
||||
2. A dispatcher is polling — verify at least one dispatcher is active at the CP dispatchers endpoint.
|
||||
3. Scaffolding present — `.agent-tasks.json` passes `jq empty`, referenced templates and repos are resolvable, and agent push keys are loaded.
|
||||
4. Auth done this session — `CLAUDE_CODE_OAUTH_TOKEN` is set or readable from secrets.
|
||||
|
||||
If any check fails, report which check failed and wait for the user to remediate. Do not proceed to Step 1 until all four pass.
|
||||
|
||||
"First invocation" means the first time this skill runs in a loop session. On subsequent loop invocations, skip Step 0.
|
||||
|
||||
### Step 1: Check running containers
|
||||
|
||||
For each task with `status: "running"`, check if the container is still alive:
|
||||
@@ -170,6 +183,8 @@ Do NOT auto-merge — the user should review and decide.
|
||||
- Keep output concise when called in a loop — just the status table unless something changed
|
||||
- On first run, if `CLAUDE_CODE_OAUTH_TOKEN` is not in the environment, read it once and export it for subsequent runs
|
||||
|
||||
**Stall circuit-breaker:** Track whether any task changed state (pending→running, running→completed/failed, etc.) across each invocation. After 5 consecutive invocations with no state change, stop dispatching, print a stuck-queue report listing every task and its current status, and wait for the user. Do not continue the loop automatically. Never run an unattended dispatch loop without this guard.
|
||||
|
||||
### Error Recovery
|
||||
|
||||
- If a task fails, its dependents are marked `blocked`. The user can:
|
||||
|
||||
Reference in New Issue
Block a user