fix: add worktree-merge to resolveModelWithFallbacksForUnit switch and update KNOWN_UNIT_TYPES (#3066)

Closes #2900

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher 2026-03-30 16:43:22 -04:00 committed by GitHub
parent 571b382075
commit 8b680179e2
3 changed files with 31 additions and 1 deletions

View file

@ -69,6 +69,7 @@ export function resolveModelWithFallbacksForUnit(unitType: string): ResolvedMode
break;
case "complete-slice":
case "complete-milestone":
case "worktree-merge":
case "run-uat":
phaseConfig = m.completion;
break;

View file

@ -100,7 +100,8 @@ export const KNOWN_PREFERENCE_KEYS = new Set<string>([
export const KNOWN_UNIT_TYPES = [
"research-milestone", "plan-milestone", "research-slice", "plan-slice",
"execute-task", "reactive-execute", "gate-evaluate", "complete-slice", "replan-slice", "reassess-roadmap",
"run-uat", "complete-milestone",
"run-uat", "complete-milestone", "validate-milestone", "rewrite-docs",
"discuss-milestone", "discuss-slice", "worktree-merge",
] as const;
export type UnitType = (typeof KNOWN_UNIT_TYPES)[number];

View file

@ -154,6 +154,34 @@ test("all auto-dispatch unitTypes have preference mapping or subagent handling",
assert.deepEqual(unmapped, [], `Unmapped unitTypes in preferences-models.ts: ${unmapped.join(", ")}`);
});
// ═══════════════════════════════════════════════════════════════════════════
// #2900: worktree-merge must map to completion phase
// ═══════════════════════════════════════════════════════════════════════════
test("#2900: resolveModelWithFallbacksForUnit handles worktree-merge", () => {
assert.ok(preferencesSrc.includes('"worktree-merge"'), "missing worktree-merge case in switch");
});
// ═══════════════════════════════════════════════════════════════════════════
// #2900: KNOWN_UNIT_TYPES must include all dispatched unit types
// ═══════════════════════════════════════════════════════════════════════════
const preferenceTypesSrc = readSrc("preferences-types.ts");
test("#2900: KNOWN_UNIT_TYPES includes all auto-dispatch unit types", () => {
const missing: string[] = [];
for (const ut of ALL_KNOWN_UNIT_TYPES) {
if (!preferenceTypesSrc.includes(`"${ut}"`)) {
missing.push(ut);
}
}
assert.deepEqual(missing, [], `Missing from KNOWN_UNIT_TYPES: ${missing.join(", ")}`);
});
test("#2900: KNOWN_UNIT_TYPES includes worktree-merge", () => {
assert.ok(preferenceTypesSrc.includes('"worktree-merge"'), "worktree-merge missing from KNOWN_UNIT_TYPES");
});
// ═══════════════════════════════════════════════════════════════════════════
// metrics.ts: classifyUnitPhase coverage
// ═══════════════════════════════════════════════════════════════════════════