fix(#1526): delegate auto-chain post-completion to transition workflow (#3419)

* fix(#1526): delegate auto-chain post-completion to transition workflow

execute-phase's auto-chain completion called phase.complete then a light inline
set (partial PROJECT.md update + offer-next) and never invoked the transition
workflow, silently skipping graduation scan, session-continuity, project-reference,
accumulated-context, and current-position updates — so a phase completed via
auto-chain left different project state than a normal transition.

Fix (delegate, user decision 2026-08-13): replace execute-phase's update_project_md
+ offer_next with a delegation step that @-includes transition.md in post-completion
mode. Add a post_completion_mode step to transition.md that skips verify_completion
+ update_roadmap_and_state (phase.complete already ran; avoids double-write) and
begins at evolve_project. Standalone transition (mode 1) is unchanged.

Regression: tests/auto-chain-transition-delegation.test.cjs (source-text-is-the-
product) asserts the delegation, the skip-set, the removed inline step, and the mode.
Ack fragment 1526 covers execute-phase.md + transition.md growth (spent 2930 fragment
removed — same-path owner conflict, like #3025/#3024).

* docs(#1526): backfill changeset PR number (#3419)

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-13 20:31:55 -04:00
committed by GitHub
parent 0624c5da6f
commit b77b7f8e56
9 changed files with 159 additions and 60 deletions

View File

@@ -1519,30 +1519,15 @@ fi
**No matches:** skip silently (always additive, non-blocking).
</step>
<step name="update_project_md">
**Evolve PROJECT.md to reflect phase completion (prevents planning document drift — #956):**
<step name="delegate_post_completion_to_transition">
**#1526 — Delegate post-completion to the transition workflow** (parity: the auto-chain
path must run the SAME post-processing as a normal transition). `phase.complete`
(`update_roadmap` above) and verification (`verify_phase_goal`) already ran, so invoke
transition in **post-completion mode**: SKIP its `verify_completion` and
`update_roadmap_and_state` (re-running `phase.complete` would double-write state) and
BEGIN at `evolve_project`, running the full set through `offer_next_phase`.
PROJECT.md tracks validated requirements, decisions, and current state. Without this step,
PROJECT.md falls behind silently over multiple phases.
1. Read `.planning/PROJECT.md`
2. If the file exists and has a `## Validated Requirements` or `## Requirements` section:
- Move any requirements validated by this phase from Active → Validated
- Add a brief note: `Validated in Phase {X}: {Name}`
3. If the file has a `## Current State` or similar section:
- Update it to reflect this phase's completion (e.g., "Phase {X} complete — {one-liner}")
4. Update the `Last updated:` footer to today's date
5. Commit the change:
```bash
gsd_run query commit "docs(phase-{X}): evolve PROJECT.md after phase completion" --files .planning/PROJECT.md
```
**Skip this step if** `.planning/PROJECT.md` does not exist.
</step>
<step name="offer_next">
@~/.claude/gsd-core/references/offer-next.md
@~/.claude/gsd-core/workflows/transition.md
</step>
</process>

View File

@@ -36,6 +36,31 @@ Mark current phase complete and advance to next. This is the natural point where
<process>
<step name="post_completion_mode" priority="first">
**Invocation mode — read this FIRST.** This workflow runs two ways:
1. **Standalone transition** (normal path): the phase is being marked complete AND
transitioned by this workflow. Run EVERY step below in order — `verify_completion`,
`update_roadmap_and_state` (which calls `gsd_run query phase.complete`), then the
post-processing.
2. **Post-completion delegation** (invoked by `execute-phase` after its auto-chain
completion — #1526): `phase.complete` was already called by execute-phase's
`update_roadmap` step and verification already passed in execute-phase's
`verify_phase_goal`. SKIP `verify_completion` and `update_roadmap_and_state`
(re-running `phase.complete` would double-write STATE.md/ROADMAP.md). Run
`cleanup_handoff` (stale `.continue-here` handoffs are still cleared post-completion),
then BEGIN at `evolve_project` and run every step from there through
`offer_next_phase` (this is the post-processing parity set: graduation scan,
session-continuity, project-reference, accumulated-context, current-position/progress).
`archive_prompts` is a documented no-op in either mode.
Detect post-completion mode when the caller states that phase completion and
verification have already run. When in doubt, run standalone (mode 1) — it is
idempotent enough to be safe, just slower.
</step>
<step name="load_project_state" priority="first">
Before transition, read project state: