feat(review): make unresolved-decisions status mandatory in GSTACK REVIEW REPORT

The report's UNRESOLVED line was optional ('omit if empty') and the EXIT
PLAN MODE GATE only checked it 'if applicable', so a plan could ship with
no statement about open decisions at all — a missed ambiguity read
identically to a clean plan. Now every report ends with a mandatory
unresolved-decisions status as its final line: either the exact unbolded
sentinel 'NO UNRESOLVED DECISIONS', or a '**UNRESOLVED DECISIONS:**' block
of bullets. The gate blocks ExitPlanMode unless that final line is present.

generatePlanFileReviewReport: current-review items are listed from context;
prior reviews contribute an aggregate count computed as latest-fresh-row-
per-skill minus the current run (no double-count, dashboard 7-day window).
generateExitPlanModeGate: check #3 is now blocking with no 'if applicable'
escape; bolded sentinel does not satisfy it.

Tests: static guard in gen-skill-docs.test.ts asserts the mandatory status
across all six report consumers and the gate across gate-bearing skills;
skill-e2e-plan.test.ts asserts the written report's final line is the
status (and fixes a stale 'four review rows' -> five-row prompt).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-06-07 22:48:53 -07:00
parent ebe2a22731
commit 54f94bec2e
13 changed files with 387 additions and 40 deletions
+46 -6
View File
@@ -119,14 +119,47 @@ Produce this markdown table:
| DX Review | \\\`/plan-devex-review\\\` | Developer experience gaps | {runs} | {status} | {findings} |
\\\`\\\`\\\`
Below the table, add these lines (omit any that are empty/not applicable):
Below the table, add these lines. **CODEX** and **CROSS-MODEL** are optional (omit when
empty); **VERDICT** is always present:
- **CODEX:** (only if codex-review ran) — one-line summary of codex fixes
- **CROSS-MODEL:** (only if both Claude and Codex reviews exist) — overlap analysis
- **UNRESOLVED:** total unresolved decisions across all reviews
- **VERDICT:** list reviews that are CLEAR (e.g., "CEO + ENG CLEARED — ready to implement").
If Eng Review is not CLEAR and not skipped globally, append "eng review required".
**Unresolved-decisions status (MANDATORY — the final content of every report).**
After the VERDICT line, the report MUST end with an unresolved-decisions status. This is
never omitted — it does NOT fall under the "omit when empty" rule above. It is the final
non-whitespace line(s) of the report section, written as content under the
\\\`## GSTACK REVIEW REPORT\\\` heading (a bold label — never a new \\\`## \\\` heading,
which would break the terminal-heading requirement). It is the last thing the user reads
before the approval prompt: either what is still open, or an explicit all-clear.
Emit exactly one of:
- **None open:** a single line containing exactly \\\`NO UNRESOLVED DECISIONS\\\`, unbolded
and with no markdown emphasis. A bolded \\\`**NO UNRESOLVED DECISIONS**\\\` does NOT count
— keep it plain so the gate's exact-line check can't be gamed by emphasis.
- **Some open:** a bold header line \\\`**UNRESOLVED DECISIONS:**\\\` followed by one bullet
per unresolved item; the last bullet is the final line of the report. Each bullet names
the decision and what breaks if it ships deferred (e.g.
"- Auth provider choice — if deferred: the login flow can't be built"). If prior
reviews carry unresolved items, add one final bullet
"+ N unresolved from prior reviews — see review rows above".
Compute the status (this avoids double-counting the current review):
1. **Current-review items:** list every unanswered AskUserQuestion / deferred decision
from THIS review's Unresolved Decisions section, one bullet each. You have these in
context — do not reconstruct them from the log.
2. **Prior-reviews count:** the log stores only \\\`unresolved:N\\\` counts, and the current
review's row is already written before this report runs. Take the latest fresh row per
review skill (same 7-day window as the dashboard), DROP the current skill's row
entirely (do NOT backfill an older row for it), and sum \\\`unresolved\\\` across the
rest. Add the "+ N unresolved from prior reviews" bullet only when that sum is > 0.
Never sum all log rows — reruns would double-count.
3. **Sentinel rule:** emit \\\`NO UNRESOLVED DECISIONS\\\` if and only if step 1 produced
zero items AND the step 2 count is zero.
### Write to the plan file
**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
@@ -169,12 +202,19 @@ missing work — do NOT call ExitPlanMode:
In-body prose that mentions "outside voice", "codex findings", or similar
does NOT count — only the structured \`## GSTACK REVIEW REPORT\` section
satisfies this check.
3. Confirm the report contains: a Runs / Status / Findings table, a VERDICT
line, and absorbs CODEX / CROSS-MODEL / UNRESOLVED lines if applicable.
4. If a plan file is in context for this skill invocation: confirm
3. Confirm the report contains a Runs / Status / Findings table and a VERDICT
line (CODEX / CROSS-MODEL lines are absorbed if applicable).
4. Confirm the report's FINAL non-whitespace line is the unresolved-decisions
status — either the exact unbolded sentinel \`NO UNRESOLVED DECISIONS\`, or a
bullet belonging to a \`**UNRESOLVED DECISIONS:**\` block that has at least one
bullet. This check is BLOCKING with no "if applicable" escape: a report with no
unresolved status, or with anything (CODEX / CROSS-MODEL / VERDICT / prose)
after it, FAILS the gate. A bolded \`**NO UNRESOLVED DECISIONS**\` does NOT
satisfy the sentinel — it must be the plain unbolded line.
5. If a plan file is in context for this skill invocation: confirm
\`gstack-review-log\` was called and \`gstack-review-read\` was run at least
once. If no plan file is in context (e.g. \`/codex consult\` against a
diff with no plan), this check short-circuits — checks 1-3 already
diff with no plan), this check short-circuits — checks 1-4 already
short-circuit when no plan file exists.
Failing this gate and calling ExitPlanMode anyway is a contract violation —