Dispatch

Orchestrate the isucon-arch-isunarabe-rev2 rollout. Fires every ready subagent in its own git worktree (up to 32 in parallel), me…

mazrean updated 2mo ago
Claude CodeGeneric
View source ↗
---
description: Orchestrate the isucon-arch-isunarabe-rev2 rollout. Fires every ready subagent in its own git worktree (up to 32 in parallel), merges each successful branch back to main, and halts on the first verify failure or merge conflict.
allowed-tools: Bash, Read, Agent
---

# isucon-arch-isunarabe-rev2 — Dispatcher

<background_information>
- **Source of truth for "done"**: git log trailers `Task: isucon-arch-isunarabe-rev2/<task-id>` on `main` after merge.
- **Source of truth for "task list"**: the **Tasks** section of `.claude/commands/isucon-arch-isunarabe-rev2/overview.md`.
- **Dependency rules**: the table below (re-encoded from the DAG in `overview.md` for unambiguous parsing).
- **Isolation**: each subagent runs in a fresh git worktree via `isolation: "worktree"`. Its commit lands on a per-worktree branch; the dispatcher merges that branch into `main` between rounds.
- **Concurrency**: up to **32 subagents in parallel** per round (operator box has 32 CPU cores). Bounded by the ready set size and the DAG, not by an arbitrary cap below 32.
- **Layering**: REV2 sits on top of REV1. **The dispatcher MUST refuse to fire** any REV2 task if any REV1 task (`isucon-arch-isunarabe/...`) is missing from `main`. Verify via `/isucon-arch-isunarabe/overview` first.
- **Mission**: fire every subagent whose dependencies are satisfied, in parallel; merge their branches; halt on the first failure or conflict; resume cleanly on re-invoke.
</background_information>

<instructions>

## Pre-flight (run BEFORE step 1)

1. Confirm REV1 is fully merged. For each REV1 task ID
   (`topology-env-systemd, topology-hosts, topology-nginx,
   topology-db-remote, topology-app-pool, schema-indexes, cache-impl,
   endpoint-1-me-join, endpoint-2-list, endpoint-3-image-detail,
   endpoint-cache-consumers, deploy-reboot-test`), run:
   ```bash
   git log main --grep="Task: isucon-arch-isunarabe/<id>" --oneline | head -1

Every result must be non-empty. If any is missing, halt with: "REV2 cannot start while REV1 is incomplete. Run /isucon-arch-isunarabe/dispatch first."

Task table (parsed by this command)

Task ID Subagent name Depends on
deploy-bench-makefile isucon-arch-isunarabe-rev2-deploy-bench-makefile
endpoint-list-rewrite isucon-arch-isunarabe-rev2-endpoint-list-rewrite
deploy-nginx-weight isucon-arch-isunarabe-rev2-deploy-nginx-weight
endpoint-join-early-409 isucon-arch-isunarabe-rev2-endpoint-join-early-409 endpoint-list-rewrite
cache-user-impl isucon-arch-isunarabe-rev2-cache-user-impl endpoint-list-rewrite
endpoint-me-cache isucon-arch-isunarabe-rev2-endpoint-me-cache cache-user-impl, endpoint-join-early-409
endpoint-webhook-fanout isucon-arch-isunarabe-rev2-endpoint-webhook-fanout endpoint-me-cache
deploy-reboot-test isucon-arch-isunarabe-rev2-deploy-reboot-test deploy-bench-makefile, endpoint-list-rewrite, endpoint-join-early-409, cache-user-impl, endpoint-me-cache, endpoint-webhook-fanout, deploy-nginx-weight

Execution Steps

  1. Snapshot state. Confirm main is the current branch, working tree clean (git status --porcelain empty). For every task ID in the table, run: git log main --grep="Task: isucon-arch-isunarabe-rev2/<task-id>" --oneline | head -1. A non-empty line means the task is done. Empty means pending.

  2. Cross-check overview. Read .claude/commands/isucon-arch-isunarabe-rev2/overview.md and confirm every done task is - [x] and every pending task is - [ ]. If a row disagrees, halt and report the drift — do not fire any subagent.

  3. Compute ready set. A task is ready if it is pending AND every dependency in its Depends on column is done.

  4. If ready set is empty AND there are pending tasks: report which parent is blocking each pending task and stop. (Indicates a previous failure that has not been resolved.)

  5. If ready set is empty AND all tasks are done: report "REV2 rollout complete. Final score check pending — re-run benchmarker and/or make -C ansible maji." and stop.

  6. Cap to 32. Take the first 32 of the ready set in the task-table order. The largest realistic round in this DAG is Round 1 = 3 tasks (the three source nodes).

  7. Fire ready tasks in parallel. Send a single message containing one Agent tool call per chosen task, with:

    • subagent_type: the task's subagent name (e.g. isucon-arch-isunarabe-rev2-endpoint-list-rewrite).
    • description: the task's short title (≤ 5 words).
    • prompt: "Run task for isucon-arch-isunarabe-rev2. Follow the subagent's instructions verbatim. Do not invoke other tasks. The working tree you see is a fresh worktree off main; commit on the worktree's current branch."
    • isolation: "worktree" — required. Each subagent gets its own worktree off main.
  8. Wait for all firings to return. Each subagent commits atomically on its worktree's branch. The Task: trailer is on that branch's tip commit, not yet on main.

  9. Merge successful branches into main. For each subagent that returned a non-empty branch (changes were committed):

    git merge --no-ff --no-edit <branch>
    

    Process branches in DAG-topological order. Among siblings of one round, any order works. On merge conflict, halt — do not attempt automatic resolution. Report the conflicting files and the two branches involved.

  10. Detect failures. For every task that was fired but did NOT return a branch with a Task: isucon-arch-isunarabe-rev2/<task-id> trailer on its tip commit, report it as failed and halt. Do not fire dependents of a failed task. (A failed subagent's worktree may have been auto-cleaned because no commits landed; verify with git worktree list.)

  11. Re-snapshot (step 1).

  12. Loop. Re-evaluate ready set (step 3). Re-fire (step 7). Continue until ready set is empty.

Halt-and-resume semantics

  • Hal

Maintain Dispatch?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Dispatch on getagentictools](https://getagentictools.com/loops/mazrean-isucon-arch-isunarabe-rev2-dispatcher?ref=badge)
npx agentictools info loops/mazrean-isucon-arch-isunarabe-rev2-dispatcher

The second line is the CLI lookup for this page — handy in READMEs and docs.