Skip to content

[Air #1900] feat: porch skip-phase — drop one plan phase after implement starts - #1908

Merged
waleedkadous merged 13 commits into
mainfrom
builder/air-1900
Nov 17, 2026
Merged

waleedkadous merged 13 commits into
mainfrom
builder/air-1900

Conversation

@waleedkadous

@waleedkadous waleedkadous commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Porch copies the plan's phases into status.yaml once, on entering implement, and never re-reads them. A phase the owner drops from an approved plan therefore stays pending forever, and review is unreachable. This adds porch skip-phase to drop one unbuilt phase from state, record why, and advance.

Closes #1900

What Changed

  • New plan-phase status skipped. The reason and time are stored on the phase itself (skip_reason, skipped_at) so they sit next to the phase they explain.
  • isPlanPhaseSettled() (complete or skipped) now drives getCurrentPlanPhase, allPlanPhasesComplete and advancePlanPhase.
  • porch skip-phase <id> <plan-phase> --reason "..." --a-human-explicitly-approved-this (commands/porch/index.ts):
    • Refuses, and writes nothing, without the human flag, without a reason, outside a per_plan_phase phase, and on unknown, complete or already-skipped phases.
    • Skipping the phase under construction resets iteration and build_complete, since that build/verify cycle belonged to the dropped phase.
    • Skipping the last unsettled phase moves the project to review.
  • porch status shows ⊘ phase_3: UI (skipped: <reason>), during implement and after it, so the skip stays visible once the project is in review.
  • Builder card (n/m) and Tower overview progress both leave skipped phases out: a skipped phase is dropped from the plan.
  • Context refresh: when the skip crosses a declared refresh boundary (enter:review, or plan-phase:<next>), skip-phase prints that a refresh is due (/builder-refresh, then porch next). It does not record the boundary; see Key Decisions.
  • Porch skill doc updated in all four copies (.claude/.codex × instance/skeleton). Shipped-skill hashes regenerated.

Key Decisions

  • The refresh is announced, not recorded. Porch can only emit a refresh task from porch next, at the transition. If skip-phase recorded the boundary, it would count as consumed with no task ever emitted, and the next normal-path porch next would acknowledge it, silently swallowing the refresh. Emitting it properly needs new pending-refresh state plus a hook in next(), which would change Spec 1470's transition-keyed, at-most-once design.

  • The hardcoded 'review' stays, for the architect to file. The schema makes on_all_phases_complete optional with no default, and the next.test.ts fixtures omit it. Reading it means either inventing a default or throwing on legacy protocols, which is a design call rather than a few lines.

  • Option 1 only (skip-phase); no re-sync command. The issue said option 1 covers the reported case. A re-sync would need reconcile rules for reordered and renamed phases, and would still need the human gate because it also changes an approved plan.

  • Fixed a latent advancePlanPhase bug. It marked phaseIndex + 1 in_progress without checking it, which would bring a skipped middle phase back. It now steps to the next unsettled phase.

  • Skipping the last phase targets 'review' literally, matching handleVerifyApproved. normalizePhase maps a per_plan_phase phase's transition.on_complete (implement itself) to next, so getNextPhase('implement') loops back to implement. A comment marks the two sites to change together.

  • No context-refresh boundary fires on a skip. It is a manual command, not a porch next transition, and a missed refresh costs only context (Spec 1470's asymmetric-cost rule).

Test Plan

  • Unit tests added: porch/__tests__/skip-phase-1900.test.ts, 15 tests. Covered:
    • skip the last phase and reach review, from either an in-progress or a pending last phase
    • skip the in-progress middle phase
    • a skipped pending middle phase is stepped over on advance
    • refusals: completed phase, no human flag (file untouched), no reason, unknown phase, wrong protocol phase, already skipped
  • The test loads the real codev-skeleton/protocols/spir/protocol.json. A hand-written fixture with next: 'review' had hidden the review-transition bug above.
  • Build passes.
  • All unit tests pass (351 files, via porch's implement check), before the main merge.
  • After merging main: typecheck clean; touched files (skip-phase-1900, plan, overview, skill-refresh, bugfix-1902-subcommand-help) 281/281; porch skip-phase --help lists the command. CI on this PR runs the full suite (no extra local full run, given the owner's machine-load concern).
  • End to end against the built bin/porch.js: a throwaway SPIR project (git repo with a bare origin), phases 1–2 complete and phase 3 in progress.
    • No flag → refused.
    • Completed phase → refused.
    • Real skip → implement → review, committed and pushed by porch.
    • porch next then emitted the review-phase tasks.
    • porch status rendered the skipped phase with its reason.

Flaky Tests

No tests were skipped (owner ruling: flaky pre-existing tests are reported and left running). Seen under machine load during porch's full-suite check:

  • packages/codev/src/__tests__/bootstrap-docs.test.ts failed in one run (93s, load average ~20).
  • packages/codev/src/__tests__/bugfix-1113-integration-base.test.ts failed in the same run (32s).

Both pass alone (65/65) and passed in the other full runs. Neither touches porch.

CMAP

Round 1 (gemini/agy lane skipped: broken for --type reviews):

  • codex = REQUEST_CHANGES
  • claude = REQUEST_CHANGES

Both had the same blocking cause: the branch was 27 commits behind main and conflicted in porch/index.ts and all four porch SKILL.md copies. Both judged the implementation itself sound.

  • Merge conflicts → Addressed. Merged origin/main (merge commit).
  • skipPlanPhase searched from index 0, advancePlanPhase from the current phase → Addressed. Both now hand in_progress forward only.
  • The overview.ts change was untested → Addressed. Added a skipped-counts-as-settled progress test.
  • Long --reason gets folded by yaml → Addressed in docs. The skill doc asks for one short line.
  • No enter:review context refresh on skip → Rebutted. Porch fires refreshes at porch next transitions, and builders must not invoke /builder-refresh on their own. skip-phase is run by a human, so there is no builder turn to hand a refresh task to.
  • Surface on_all_phases_complete through normalizePhase so neither site hardcodes 'review' → N/A here. Both reviewers called it out of AIR scope, and it would touch the working handleVerifyApproved refresh path. The coupling comment marks both sites.

Round 2, on the merged branch:

  • codex = APPROVE
  • claude = APPROVE (all 8 CI checks green on the reviewed head)

Claude's non-blocking polish was fixed in place:

  • Guard: refuse, writing nothing, when the protocol has no review phase. Writing a phase next would read as "protocol complete" was worse than an error.
  • Handoff: skipping a pending current phase now hands in_progress forward too.
  • Status banner: the porch status "DO NOT start " banner no longer names a skipped phase.
  • Error order: a bare porch skip-phase <id> <phase> reports the missing human flag before the missing reason.
  • Skill doc: says to run it from the builder's worktree. Porch commits and pushes status.yaml in whichever checkout it runs from.

Not done:

  • a unit test of the CLI argument branch (covered by the manual CLI run);
  • rejecting newlines in --reason (the doc asks for one line, and claude traced that yaml folding is harmless to Tower's parser).

Architect integration review

codex = REQUEST_CHANGES, claude = APPROVE. Fold-ins:

  1. Status after the last phase: skipped phases stay visible after implement. Addressed, with a test and checked with the real CLI.
  2. Context-refresh boundaries: Addressed by printing the refresh notice (rationale in Key Decisions), tested for both the enter:review and plan-phase:<next> cases.
  3. getNextPlanPhase: now skip-aware. One nextUnsettledIndex helper serves getNextPlanPhase, advancePlanPhase and skipPlanPhase; the status banner uses it. Addressed.
  4. Card label vs progress: both leave skipped phases out. Addressed, with tests in overview.test.ts and BuilderCard.test.tsx.
  5. Small items: removed the unused isPlanPhaseComplete import; added skip-phase to arch.md's porch command list; the skill says the builder runs it after the architect relays the human's decision. Addressed.

Targeted tests only, no local e2e:

  • porch, overview, skill-refresh, 1470 status-visibility and 1902 help tests: 310/310
  • web BuilderCard: 13/13
  • both typechecks clean

Review Notes

  • Focus on advancePlanPhase (plan.ts). Its behavior changed for any phase list that contains a skipped phase; it is unchanged otherwise, and the existing tests still pass.
  • skip-phase is human-only, like approve. The skill doc says builders must not run it on their own.
  • Size: ~190 lines of production code including comments, plus ~165 lines of tests.

waleedkadous and others added 11 commits November 16, 2026 13:52
…nt starts

Plan phases are snapshotted into status.yaml once, on entering implement, so
a phase the owner drops from an approved plan stayed pending forever and
review was unreachable.

- New plan-phase status `skipped` (with skip_reason / skipped_at on the phase).
- isPlanPhaseSettled (complete | skipped) drives getCurrentPlanPhase,
  allPlanPhasesComplete and advancePlanPhase; advancePlanPhase now steps over a
  skipped phase instead of blindly marking phaseIndex + 1 in_progress.
- `porch skip-phase <id> <plan-phase> --reason "..." --a-human-explicitly-approved-this`:
  refuses without the human flag, without a reason, outside a per_plan_phase
  phase, and on unknown/complete/already-skipped phases. Skipping the last
  unsettled phase moves to review.
- porch status shows skipped phases with their reason; Tower overview counts
  them as settled.
- Porch skill docs (all four copies) document the command.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	.claude/skills/porch/SKILL.md
#	.codex/skills/porch/SKILL.md
#	codev-skeleton/.claude/skills/porch/SKILL.md
#	codev-skeleton/.codex/skills/porch/SKILL.md
#	packages/codev/src/commands/porch/index.ts
…rview test)

- skipPlanPhase hands in_progress forward only, symmetric with advancePlanPhase.
- overview progress test: a skipped plan phase counts as settled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Refuse skipping the last phase when the protocol has no 'review' phase.
- Skipping a pending current phase hands in_progress forward.
- porch status banner no longer names a skipped phase as "next".
- CLI reports the missing human flag before a missing reason.
- Skill doc: run skip-phase from the builder's worktree (porch pushes status.yaml).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@waleedkadous

Copy link
Copy Markdown
Contributor Author

Thank you, this fits porch's conventions well, and loading the real SPIR protocol.json in the tests (which caught the implement loop) was the right instinct.

Independent integration reviews: codex REQUEST_CHANGES, claude APPROVE with follow-ups. I would like these folded in before it goes to the owner:

  1. porch status after skipping the last phase (codex). This is the case the issue was filed for, and my baked decision asked that status show the phase as skipped. Once the state moves to review, the plan-phase list is suppressed, so the skip is invisible. Please keep skipped phases (with reason) visible in status after implement.
  2. Context-refresh boundaries (codex). The skip path advances to the next plan phase or to review without the plan-phase:<next> / enter:review refresh the normal path records. If recording the boundary so the builder's next porch next emits the refresh task is small, do that; if it is not, print a clear line telling the human to have the builder refresh before continuing, and say which you chose and why.
  3. getNextPlanPhase in plan.ts is still index+1 and skip-unaware; delete it or make it settled-aware.
  4. Builder card label (n/m) still counts skipped phases in m while progress treats them as settled; make them agree.
  5. Small: the unused isPlanPhaseComplete import in index.ts; add skip-phase to the porch command list in codev/resources/arch.md; in the skill text say who runs it (the builder, after the architect relays the human's decision), matching the approve wording.

On the hard-coded 'review': if reading on_all_phases_complete in normalizePhase and using it at both sites is a few lines, perhaps do it here; if it grows, leave it and I will file it.

Please keep to targeted tests while iterating and do not run the local e2e suite.

- porch status keeps listing skipped plan phases (with reason) after implement.
- skip-phase prints a refresh notice when it crosses a declared context-refresh
  boundary (enter:review / plan-phase:<next>); it cannot emit the task itself.
- getNextPlanPhase is skip-aware; one nextUnsettledIndex helper for all three
  navigation sites; status banner uses it.
- Builder card (n/m) and overview progress both leave skipped phases out.
- Drop unused isPlanPhaseComplete import; skip-phase in arch.md's porch list;
  skill says the builder runs it after the architect relays the decision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@waleedkadous
waleedkadous merged commit e2403c3 into main Nov 17, 2026
8 checks passed
waleedkadous added a commit that referenced this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

porch: no way to drop or amend a plan phase after implement starts (phase list is snapshotted once)

1 participant