# Case: `strict-worktree-dispatch-launches-worker-through-codex-bridge` ## Test Type This is a `forward-test` and a worktree launch-bridge validation. The goal is to verify that a leader using the packaged `orch` skill can dispatch a code task, render a standardized worker brief from the saved dispatch JSON, and launch a worker subagent that respects the assigned worktree contract. ## Purpose Validate that all of the following can be true at the same time: - the leader can dispatch a code task with `--execution-mode code` through the bundled orch skill - the leader can turn that dispatch JSON into a stable worker brief through `./assets/orch-worker-brief` - the launched worker subagent uses `skills/inbox/` and reports through inbox - the launched worker observes the assigned `worktree_path` and completes the attempt - the leader can reconcile the finished task and clean the attempt worktree ## Preconditions - orch skill path exists: `ORCH_SKILL_PATH=skills/orch` - inbox skill path exists: `INBOX_SKILL_PATH=skills/inbox` - bundled CLI executables exist at `ORCH_SKILL_PATH/assets/orch` and `INBOX_SKILL_PATH/assets/inbox` - the helper asset exists at `ORCH_SKILL_PATH/assets/orch-worker-brief` - use an empty temporary directory `TMPDIR` - initialize `TMPDIR/coord.db` before launching role agents through `INBOX_SKILL_PATH/assets/inbox --db TMPDIR/coord.db --json init` - create `TMPDIR/repo` as a Git repository with one committed file before launching agents ## Agent Topology - `leader` The leader is responsible for spawning the code-writing worker subagent after dispatch. ## Inputs ### Leader Prompt ```text Use $orch at ORCH_SKILL_PATH to act as leader on the already initialized SQLite DB TMPDIR/coord.db. Only coordinate through the bundled orch CLI from the skill. Workflow: 1) create run run_blog_skill_launch_worktree_001, 2) add one code task T1 for worker-a, 3) dispatch it with --execution-mode code --repo-path TMPDIR/repo --workspace-root .orch/worktrees while saving --json to TMPDIR/dispatch.json, 4) render a worker brief with ORCH_SKILL_PATH/assets/orch-worker-brief into TMPDIR/worker-brief.txt, 5) spawn one worker subagent that uses INBOX_SKILL_PATH and the generated worker brief, 6) wait until the worker completes, 7) inspect final status, 8) clean up attempt 1, 9) stop after reporting RUN_ID, THREAD_ID, and WORKTREE_PATH. Do not use ordinary chat to coordinate with the worker; the launched worker must use inbox only and should respect the assigned worktree. ``` ## Execution Parameters - use the shared execution contract from [README.md](./README.md) - use the shared timeout defaults from [README.md](./README.md) - do not override the default cleanup policy ## Execution Steps 1. Initialize `TMPDIR/coord.db` once through the bundled inbox CLI before launching agents 2. Create `TMPDIR/repo` with an initial commit before launching agents 3. Inject `skills/orch/` into `leader` 4. Ensure `leader` can also reference `skills/inbox/` by path when it spawns the worker subagent 5. Point the leader at the same database path `TMPDIR/coord.db` 6. Launch `leader` 7. Wait for `leader` and any spawned worker subagent(s) to finish 8. Resolve `THREAD_ID` and `WORKTREE_PATH` from the leader output 9. Independently run the validation commands from the main thread ## Validation Commands ```bash ORCH_SKILL_PATH/assets/orch --db TMPDIR/coord.db --json status --run run_blog_skill_launch_worktree_001 INBOX_SKILL_PATH/assets/inbox --db TMPDIR/coord.db --json show --thread THREAD_ID test -f TMPDIR/dispatch.json test -f TMPDIR/worker-brief.txt test ! -d WORKTREE_PATH ``` ## Expected Outcomes - the leader reports a non-empty `WORKTREE_PATH` from dispatch - the rendered worker brief includes that same `worktree_path` - the launched worker subagent claims the assigned thread and completes it through inbox - the final run status is `done` - the cleanup step removes the worktree directory ## Assertions - `status.data.run.status == "done"` - `status.data.tasks[0].status == "done"` - `status.data.tasks[0].latest_attempt.worktree_path == WORKTREE_PATH` - `show.data.thread.status == "done"` - the task-side thread history includes a payload field or body content referencing the worktree path - `TMPDIR/worker-brief.txt` mentions the expected `WORKTREE_PATH` - `WORKTREE_PATH` does not exist after cleanup ## Cleanup - use the default cleanup policy from [README.md](./README.md) - if the run fails, retain `TMPDIR`, `coord.db`, and the Git repo fixture for replay and manual inspection ## Recorded Example Run - no recorded run yet - this case should be captured with a real leader agent plus leader-launched worker subagent after the launch bridge assets are adopted