-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Description
The touchSet field exists in the JobSpec schema (file glob patterns indicating which files a job expects to modify), but no logic uses it. Implementing conflict prediction would warn users before launching jobs with overlapping file globs, preventing wasted compute on work that will inevitably conflict at merge time.
Use Case
When orchestrating a plan with multiple jobs, two jobs may unknowingly modify the same files. Currently, this is only discovered at merge time — after both jobs have run to completion. With touchSet conflict prediction:
- Pre-launch validation: Before launching a plan, check for overlapping touchSets between parallel jobs (jobs without dependency ordering). Warn or block.
- Blast radius scoring: Score each job by how many files it touches and how many overlap with other jobs, helping the user assess risk.
- Auto-inference: After a job completes, capture
git diff --name-onlyand store as the actual touchSet for future reference.
Proposed Solution
Phase 1: Static conflict detection
- In
orchestrator.tsvalidatePlan()orstartPlan(), compare touchSets of jobs that can run in parallel (no dependency chain between them). - Use glob matching (e.g.,
Bun.globorminimatch) to detect overlaps. - Return warnings in the plan creation response.
Phase 2: Auto-inference
- After a job completes and before merge, run
git diff --name-onlyon the job's branch. - Store the result as
actualTouchSetin the job state. - Use this for future plans with similar prompts.
Phase 3: Blast radius scoring
- Score:
(overlapping files with other jobs) / (total files touched). - Surface in
mc_plan_statusandmc_overview.
Files Involved
src/lib/schemas.ts:58—touchSetfield definition (already exists)src/lib/plan-types.ts:47—touchSettype (already exists)src/lib/orchestrator.ts—validatePlan()needs conflict checking logicsrc/tools/plan.ts— surface warnings in plan creation response
Additional Context
From the master audit report (Section 9: Phase 2 roadmap): "Implement touchSet conflict prediction + blast radius scoring" and "Auto-infer touchSet from git diff --name-only." The schema infrastructure is already in place — this is purely logic implementation.