Skip to content

Commit 0bf88f3

Browse files
committed
docs: document touchSet enforcement, relaunch, and updated mc_plan_approve
Add TouchSet Enforcement section explaining the three violation options. Update mc_plan_approve reference with retry and relaunch parameters. Expand touchSet field description in JobSpec table. Add touchSet validation step to Merge Train flow. Add FAQ entry for touchSet violations.
1 parent 54c4aca commit 0bf88f3

1 file changed

Lines changed: 46 additions & 6 deletions

File tree

README.md

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ Create and start a multi-job orchestrated plan.
504504
| `name` | `string` | Yes | Unique job name |
505505
| `prompt` | `string` | Yes | Task prompt for the AI agent |
506506
| `dependsOn` | `string[]` | No | Job names this job depends on (must complete and merge first) |
507-
| `touchSet` | `string[]` | No | File globs this job expects to modify |
507+
| `touchSet` | `string[]` | No | File globs this job expects to modify. After completion, the orchestrator validates that only files matching these patterns were changed. Violations pause the plan — see [TouchSet Enforcement](#touchset-enforcement). |
508508
| `mode` | `"vanilla"` \| `"plan"` \| `"ralph"` \| `"ulw"` | No | Execution mode override (defaults to `omo.defaultMode` config) |
509509
| `copyFiles` | `string[]` | No | Files to copy into the worktree |
510510
| `symlinkDirs` | `string[]` | No | Directories to symlink into the worktree |
@@ -563,11 +563,21 @@ Show the current state of the active plan — job statuses, progress, and any ch
563563

564564
#### `mc_plan_approve`
565565

566-
Approve a copilot plan to start execution, or clear a supervisor checkpoint to continue.
566+
Approve a pending copilot plan, clear a supervisor checkpoint, or handle a failed job. When a touchSet violation pauses the plan, three actions are available:
567567

568568
| Parameter | Type | Required | Description |
569569
|-----------|------|----------|-------------|
570570
| `checkpoint` | `"pre_merge"` \| `"on_error"` \| `"pre_pr"` | No | Specific checkpoint to clear (supervisor mode) |
571+
| `retry` | `string` | No | Name of a failed/conflict/needs_rebase job to retry after manual fix. Re-validates touchSet before proceeding. |
572+
| `relaunch` | `string` | No | Name of a touchSet-failed job to relaunch. Spawns a new agent in the existing worktree with a correction prompt. |
573+
574+
**TouchSet violation options:**
575+
576+
| Action | Command | Behavior |
577+
|--------|---------|----------|
578+
| **Accept** | `mc_plan_approve(checkpoint: "on_error")` | Violations are legitimate — skip validation and proceed to merge |
579+
| **Relaunch** | `mc_plan_approve(checkpoint: "on_error", relaunch: "job")` | Spawn agent to fix — relaunches in existing worktree with violation details |
580+
| **Retry** | `mc_plan_approve(checkpoint: "on_error", retry: "job")` | You fixed it manually — re-validates touchSet, then proceeds if clean |
571581

572582
#### `mc_plan_cancel`
573583

@@ -622,14 +632,38 @@ Result:
622632

623633
> **Why not `mc_launch`?** You *could* launch these sequentially, merging each into main before starting the next. But you'd lose the automated test gating, the single integration PR, and the parallel execution of `dashboard-ui` and `docs`. The plan handles the dependency graph, merge ordering, and PR creation — you just check `mc_plan_status` or wait for the completion notification.
624634
635+
### TouchSet Enforcement
636+
637+
When a job specifies `touchSet` patterns, the orchestrator validates the job's changes after completion — before the job enters the merge train. If the job modified files that don't match any `touchSet` glob, the plan pauses with an `on_error` checkpoint:
638+
639+
```
640+
❌ Job "db-schema" modified files outside its touchSet:
641+
Violations: src/types/search.ts, src/utils/format.ts
642+
Allowed: src/db/**
643+
644+
Options:
645+
Accept violations: mc_plan_approve(checkpoint: "on_error")
646+
Agent fixes branch: mc_plan_approve(checkpoint: "on_error", relaunch: "db-schema")
647+
You fix, re-check: mc_plan_approve(checkpoint: "on_error", retry: "db-schema")
648+
```
649+
650+
| Option | When to use |
651+
|--------|-------------|
652+
| **Accept** | You reviewed the violations and they're legitimate (e.g., the agent needed to update shared types) |
653+
| **Relaunch** | The violations are accidental — a new agent spawns in the same worktree with a correction prompt to revert them |
654+
| **Retry** | You manually fixed the branch — Mission Control re-validates the touchSet before proceeding |
655+
656+
The **relaunch** path reuses the existing worktree and branch. The correction agent sees the full git history and receives a prompt with the original task, the specific violations, and the allowed patterns. After the agent completes, touchSet validation runs again automatically.
657+
625658
### Merge Train
626659

627660
The Merge Train is the engine behind plan integration. Each completed job's branch is merged into a dedicated **integration branch** (`mc/integration-{plan-id}`):
628661

629-
1. **Merge**`git merge --no-ff {job-branch}` into the integration worktree
630-
2. **Test** — If a `testCommand` is configured (or detected from `package.json`), it runs after each merge
631-
3. **Rollback** — If tests fail or time out, the merge is automatically rolled back (`git merge --abort` or `git reset --hard HEAD~1`)
632-
4. **Conflict detection** — Merge conflicts are caught, reported with file-level detail, and the merge is aborted
662+
1. **TouchSet validation** — If `touchSet` is configured, verify the job only modified allowed files (violations pause the plan)
663+
2. **Merge**`git merge --no-ff {job-branch}` into the integration worktree
664+
3. **Test** — If a `testCommand` is configured (or detected from `package.json`), it runs after each merge
665+
4. **Rollback** — If tests fail or time out, the merge is automatically rolled back (`git merge --abort` or `git reset --hard HEAD~1`)
666+
5. **Conflict detection** — Merge conflicts are caught, reported with file-level detail, and the merge is aborted
633667

634668
Once all jobs are merged and tests pass, the integration branch is pushed and a PR is created.
635669

@@ -803,6 +837,12 @@ Yes. Use `mc_attach` to get the tmux command, then run it in your terminal. You'
803837
If the configured `testCommand` fails after a merge, the merge is automatically rolled back. The job is marked as failed and the plan status updates accordingly (in supervisor mode, it pauses for your review).
804838
</details>
805839

840+
<details>
841+
<summary><strong>What happens if a job modifies files outside its touchSet?</strong></summary>
842+
843+
The plan pauses at an `on_error` checkpoint with three options: **accept** the violations if they're legitimate, **relaunch** the agent with a correction prompt to fix them, or **retry** after you fix the branch manually. See [TouchSet Enforcement](#touchset-enforcement) for details.
844+
</details>
845+
806846
<details>
807847
<summary><strong>Why not just tell my agents to run <code>git worktree add</code> themselves?</strong></summary>
808848

0 commit comments

Comments
 (0)