fix(#3807): advance-plan refuses an ambiguous multi-Phase Current Position (#4028)

* test(#3807): advance-plan must refuse an ambiguous multi-entry Current Position

* fix(#3807): refuse an ambiguous multi-Phase Current Position before advancing

* chore(#3807): changeset fragment (pr number backfilled after PR creation)

* chore(#3807): backfill changeset PR number (4028)

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-29 03:50:03 -04:00
committed by GitHub
parent 3a4c3cb83e
commit b811ea16fc
5 changed files with 146 additions and 3 deletions

View File

@@ -894,6 +894,16 @@ function cmdStateAdvancePlan(cwd: string, raw: boolean): void {
}, cwd, { divergedFields, preWriteState });
if (!resultData || resultData['error']) {
// #3807: a multi-`Phase:` Current Position section carries its own cause
// and its own remedy (name the candidates; the caller resolves them).
if (resultData && resultData['reason'] === 'ambiguous_position_phase') {
output({
error: 'Current Position section contains more than one Phase: entry — refusing to silently advance the first. Resolve the section to a single current entry and re-run.',
reason: resultData['reason'],
phase_candidates: resultData['phase_candidates'],
}, raw, undefined);
return;
}
output({ error: 'Cannot parse Current Plan or Total Plans in Phase from STATE.md' }, raw, undefined);
return;
}