feat(autoplan): eng review always runs last — the gate reviews the final amended plan

Reorder the pipeline to CEO -> Design (if UI scope) -> DX (if developer-facing
scope) -> Eng. The old order (CEO -> Design -> Eng -> DX) let DX findings land
AFTER the required gate signed off, so eng validated a stale plan.

Accept-all semantics made explicit: every AskUserQuestion resolves to the
recommended option; premises no longer pause the pipeline mid-run (clearly-wrong
ones queue as User-Challenge items at the single Final Approval Gate). Eng's
Codex voice now sees the DX consensus summary. New free static test pins the
order; the chain E2E gains DX-between and Eng-terminal assertions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-28 01:41:29 +00:00
co-authored by Claude Fable 5
parent 394db326f2
commit 848973007c
11 changed files with 216 additions and 104 deletions
+15 -5
View File
@@ -6,8 +6,9 @@
*
* "**Phase 1 complete." (CEO) →
* "**Phase 2 complete." (Design — only if UI scope detected) →
* "**Phase 3 complete." (Eng)
* "**Phase 3.5 complete." (DX — optional, skipped if no DX scope)
* "**Phase 2.5 complete." (DX — optional, skipped if no DX scope)
* "**Phase 3 complete." (Eng — always runs, always LAST: the required
* gate reviews the final amended plan)
*
* Why this exists: each individual phase has its own plan-mode smoke
* test. Nothing verifies the SEQUENCING — that phases don't run in
@@ -88,7 +89,7 @@ describeE2E('/autoplan chain ordering (periodic)', () => {
// Phase markers live in autoplan's carved phase sections
// (autoplan/sections/{ceo,design,eng,dx}-phase.md — the skeleton
// STOP-Reads each one at its phase boundary):
// "**Phase 1 complete." / "**Phase 2 complete." / "**Phase 3 complete." / "**Phase 3.5 complete."
// "**Phase 1 complete." / "**Phase 2 complete." / "**Phase 2.5 complete." / "**Phase 3 complete."
const phasePattern = /\*\*Phase\s+(\d+(?:\.\d+)?)\s+complete\.?\*\*/g;
let lastPermSig = '';
@@ -163,13 +164,22 @@ describeE2E('/autoplan chain ordering (periodic)', () => {
);
}
// Sequencing: CEO must end before Eng ends. Design (if observed)
// must end after CEO and before Eng.
// Sequencing: CEO must end before Eng ends — and Eng is the terminal
// phase (the required gate reviews the final amended plan). Design and
// DX (if observed) must end after CEO and before Eng.
expect(ceo.ts).toBeLessThan(eng.ts);
if (design) {
expect(design.ts).toBeGreaterThan(ceo.ts);
expect(design.ts).toBeLessThan(eng.ts);
}
const dx = hits.find(h => h.phase === 2.5);
if (dx) {
expect(dx.ts).toBeGreaterThan(ceo.ts);
expect(dx.ts).toBeLessThan(eng.ts);
}
// No phase marker may appear after Eng's (Eng-last invariant).
const maxTs = Math.max(...hits.map(h => h.ts));
expect(eng.ts).toBe(maxTs);
} finally {
try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch { /* ignore */ }
}