fix(#4776): resolve the artifact-exists prompt under --auto (#4832)

* fix(#4776): resolve the artifact-exists prompt under --auto

/gsd-ui-phase <phase> --auto stopped at 'UI-SPEC.md already exists for
Phase {N}. What would you like to do?' whenever the file was on disk —
which is most often after an earlier run wrote the contract as a draft
and ended before its checker ran, exactly the state a re-run exists to
verify. Step 4 had no --auto arm; step 9.5 in the same file has had one
since it was added, which is how the drift went unnoticed.

Step 4 now auto-selects Skip: the existing UI-SPEC is left untouched and
the run proceeds to the checker. Skip is the only non-destructive choice
— Update re-runs the researcher, which rewrites the whole contract and
drops answers a person already recorded in it, and View exits without
verifying anything.

spec-phase.md's artifact-exists arm auto-selected 'Update it', which is
the same defect with the opposite sign: an unattended run regenerating a
spec nobody is watching. Per the decision recorded on #4776 — an
unattended run reuses an existing artifact rather than regenerating it —
it now auto-selects Skip and leaves the spec unchanged.

The max-revision-iterations escalation (Force approve / Edit manually /
Abandon) is deliberately untouched and pinned by a test: accepting
blocking findings is a decision a person makes.

Closes #4776

* chore(#4776): add changeset fragment

Emitted-Drift-Ack-Growth: ui-phase.md — --auto arm added to the existing-UI-SPEC branch (#4776)
Emitted-Drift-Ack-Growth: spec-phase.md — --auto arm reworded to reuse the existing SPEC (#4776)

* fix(#4776): extend the reuse-as-is --auto fix to the 3 sibling files

The PR's original scope claim -- that ai-integration-phase.md,
eval-review.md and ui-review.md were "scoped by triage to their own
issues" -- was false; no such issues existed, and it contradicted #4776's
own most recent (2026-09-16) triage comment, which explicitly widened the
fix to require all 5 files under one recommended fix.

Applies the same reuse-as-is pattern: ai-integration-phase.md mirrors
ui-phase.md's 3-way Update/View/Skip shape (auto-selects Skip);
eval-review.md and ui-review.md have only Re-audit/View (auto-selects
View, the only non-regenerating choice). None of the three had any prior
--auto handling at all -- each has exactly one AskUserQuestion call site
total, and it is the one this fix resolves, so an --auto run through any
of them no longer stalls anywhere.

Emitted-Drift-Ack-Growth: ai-integration-phase.md — the --auto arm reusing an existing AI-SPEC is the deliverable (#4776)
Emitted-Drift-Ack-Growth: eval-review.md — the --auto arm reusing an existing EVAL-REVIEW is the deliverable (#4776)
Emitted-Drift-Ack-Growth: ui-review.md — the --auto arm reusing an existing UI-REVIEW is the deliverable (#4776)

---------

Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
This commit is contained in:
Michel Moreira
2026-09-23 12:13:34 -03:00
committed by GitHub
parent b90eef28e8
commit af822a8024
8 changed files with 153 additions and 6 deletions

View File

@@ -79,7 +79,15 @@ AI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-AI-SPEC.md 2>/dev/null | head -1)
```
**Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Antigravity, etc.) where `AskUserQuestion` is not available.
**If exists:** Use AskUserQuestion:
**If exists:**
**If `--auto`:** Auto-select "Skip" — keep the existing AI-SPEC untouched and exit. Log:
`[auto] AI-SPEC exists — reusing as-is.` Skip is the auto choice because it is the only
non-destructive one: "Update" re-runs framework selection with the existing spec as baseline,
which can rewrite decisions a person already recorded in it, and nobody is present to notice
(#4776).
**Otherwise:** Use AskUserQuestion:
- header: "Existing AI-SPEC"
- question: "AI-SPEC.md already exists for Phase {N}. What would you like to do?"
- options:

View File

@@ -46,7 +46,13 @@ EVAL_REVIEW_FILE=$(ls "${PHASE_DIR}"/*-EVAL-REVIEW.md 2>/dev/null | head -1)
**State C** — No SUMMARY.md: Exit — "Phase {N} not executed. Run /gsd:execute-phase {N} first."
**Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Antigravity, etc.) where `AskUserQuestion` is not available.
**If `EVAL_REVIEW_FILE` non-empty:** Use AskUserQuestion:
**If `EVAL_REVIEW_FILE` non-empty:**
**If `--auto`:** Auto-select "View" — keep the existing EVAL-REVIEW.md untouched and exit without
re-auditing. Log: `[auto] EVAL-REVIEW.md exists — reusing as-is.` "Re-audit" is the regenerating
choice; an unattended run reuses an existing artifact instead (#4776).
**Otherwise:** Use AskUserQuestion:
- header: "Existing Eval Review"
- question: "EVAL-REVIEW.md already exists for Phase {N}."
- options:

View File

@@ -79,7 +79,11 @@ ls ${phase_dir}/*-SPEC.md 2>/dev/null | grep -v AI-SPEC | head -1 || true
If SPEC.md already exists:
**If `--auto`:** Auto-select "Update it". Log: `[auto] SPEC.md exists — updating.`
**If `--auto`:** Auto-select "Skip" — leave the existing SPEC.md unchanged and exit with the same
message the interactive "Skip" prints. Log: `[auto] SPEC.md exists — reusing as-is.` An unattended
run reuses an existing artifact rather than regenerating it (#4776): "Update it" re-scores and
rewrites the spec, discarding answers a person already recorded in it, and nobody is present to
notice.
**Otherwise:** Use AskUserQuestion:
- header: "Spec"

View File

@@ -99,7 +99,16 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
```
**Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Antigravity, etc.) where `AskUserQuestion` is not available.
**If exists:** Use AskUserQuestion:
**If exists:**
**If `--auto`:** Auto-select "Skip" — keep the existing UI-SPEC untouched and proceed to step 7
(checker). Log: `[auto] UI-SPEC exists — reusing as-is, proceeding to verification.` Skip is the
auto choice because it is the only non-destructive one: "Update" re-runs the researcher, which
rewrites the whole contract and drops answers a person already recorded in it, and "View" exits
without verifying anything. A `--auto` run most often meets this file as an unverified draft from
a run that ended before its checker ran, which is exactly the state the checker should now see.
**Otherwise:** Use AskUserQuestion:
- header: "Existing UI-SPEC"
- question: "UI-SPEC.md already exists for Phase {N}. What would you like to do?"
- options:

View File

@@ -51,7 +51,13 @@ UI_REVIEW_FILE=$(ls "${PHASE_DIR}"/*-UI-REVIEW.md 2>/dev/null | head -1)
**If `SUMMARY_FILES` empty:** Exit — "Phase {N} not executed. Run /gsd:execute-phase {N} first."
**Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `AskUserQuestion` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-Claude runtimes (OpenAI Codex, Antigravity, etc.) where `AskUserQuestion` is not available.
**If `UI_REVIEW_FILE` non-empty:** Use AskUserQuestion:
**If `UI_REVIEW_FILE` non-empty:**
**If `--auto`:** Auto-select "View" — keep the existing UI-REVIEW.md untouched and exit without
re-auditing. Log: `[auto] UI-REVIEW.md exists — reusing as-is.` "Re-audit" is the regenerating
choice; an unattended run reuses an existing artifact instead (#4776).
**Otherwise:** Use AskUserQuestion:
- header: "Existing UI Review"
- question: "UI-REVIEW.md already exists for Phase {N}."
- options: