Skip to content

Use Garry Tan's exact Claude Code setup: 23 opinionated tools that serve as CEO, Designer, Eng Manager, Release Manager, Doc Engineer, and QA

TypeScript

v1.91.91.0 fix(review-gates): fail closed on unparsed severities, survive auto-compaction copies, read-only plan-eng-review reports back (Wave 9 Lane B) (#3143)

Garry Tan8fc9f2a58d77
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4733c54fc..e72113238 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Changelog
+## [1.91.91.0] - 2026-10-11
+
+**Review gates fail closed: a Codex reply that lists P1 findings is never `clean`, /autoplan survives a Claude Code auto-compaction, and a read-only /plan-eng-review finishes `DONE` instead of `BLOCKED` (Wave 9 lane B).**
+
+- **Outside-review severities (#3105).** `lib/outside-review-result.ts` now reads P0-P3 labels in label position for every gate that summarises a review, the `execution` gate behind `/codex` consult and challenge included: `**P1 — x**`, `**P1** — x`, `1. P2 — x`, a bare `P2 —`, `### P1` and table cells `| P1 |`, plus the label-position severity words that only `review`/`structured` read before. A P0-P3 token in label position that none of these forms reads (`## P1/P2 findings`) is `VERDICT: unverified` with the new reason `unparsed_severity`, an `UNPARSED: line N: "..."` line and its own troubleshooting anchor; parsed P0/P1 findings still win (exit 3) and print the unparsed line too. A reply whose last `Verdict:` line says `not ready` with no readable severity prints `FINDINGS: unspecified` and exits 3. Code fences and inline code are quotes, not labels; an unlabeled consult answer stays `clean`.
+- **Post-compaction journals (#3107).** Claude Code 2.1.293 writes the kept conversation again after an auto-compaction boundary: new uuids, relinked parents, zeroed usage, identical otherwise. The owned journal reader (`lib/claude-owned-journal.ts`) now collapses such a copy into its pre-boundary original for every record kind, so the publication guard no longer denies every phase entry with `tool_identity`, a copied `/autoplan` prompt no longer trips `init_own`, and a copied end turn plus typed prompt no longer disarms the guard. A copy that differs in anything else, or a duplicate with no boundary between, still fails closed.
+- **Read-only /plan-eng-review (#3106).** When the caller forbids writing the report or the review log, the review now follows **Report-back outcome**: it returns the full report and ledger labeled not persisted, records telemetry `success`, ends `DONE` with `PERSISTED: no`, and its last line is `PERSIST: <gstack-review-log command>` for the caller to run. No new completion status; a failed permitted save is still `BLOCKED`. With no saved Eng Review, /ship's readiness dashboard now says to run that `PERSIST:` line or rerun the review.
+
+Thanks @kolla23 (#3105)
+Thanks @kolla23 (#3106)
+Thanks @Mr-B-1 (#3107)
+
## [1.91.90.0] - 2026-10-11
**Windows checkouts stop breaking gstack's nested shell scripts on Linux, the timeline Stop hook repairs on Windows instead of timing out every turn, and the `/setup-gbrain` smoke test stops piping into `gbrain put`.**
@@ -2620,7 +2632,6 @@ What this means for anyone shipping here: PRs get one honest paid verdict faster
- `bun run eval:flake-rank` (with `--json`, `--dir`, `--since-days`) is the promotion-clock dial; the WS16 required-check decision reads it.
- The overhaul plan (16 workstreams, reviewed by CEO + eng passes with two cross-model outside voices) continues: budget-aware shard walls, PTY readiness events, free-suite splits, judge determinism, and required-check promotion are the next waves.
-
## [1.76.0.0] - 2026-08-31
**Ship's doc-sync now survives Conductor.**
@@ -6469,7 +6480,6 @@ If you run `/retro` on a Conductor branch that's been around for a few days, the
- Defer-doc artifact `~/.gstack-dev/plans/1539-framework-aware-review.md` describes the multi-week framework-aware ORM verification extension (Django/Rails/SQLAlchemy detection, model-introspection helpers, migration-history-aware checks) intentionally deferred from this wave. Promote to active plan when v1.43.0.0 ships and a second high-volume FP report lands on a different framework, or a follow-up retro shows the lighter quoted-line gate doesn't deliver measurable FP reduction.
- Wave shape preserved from Daegu pattern: ONE bundled PR with bisect commits, atomic squashed commits for `.tmpl` edit + `gen:skill-docs` regen pairs, intermediate verification checkpoints, original contributors credited in commit author + footer. See `[[feedback_one_pr_fix_waves]]` in agent memory.
-
## [1.43.1.0] - 2026-05-21
## **Local gbrain PGLite now defaults to Voyage's code-specialized embedding model when `VOYAGE_API_KEY` is set.**
@@ -6518,7 +6528,6 @@ If you have `VOYAGE_API_KEY` set and run `/setup-gbrain` on a fresh machine, `gb
**Regenerated**
- `setup-gbrain/SKILL.md`, `sync-gbrain/SKILL.md` — refreshed via `bun run gen:skill-docs --host all` after the template edits
-
## [1.43.0.0] - 2026-05-20
## **iOS QA on a real iPhone — no XCTest, no WebDriverAgent, no simulators.**
diff --git a/VERSION b/VERSION
index ed6c016a6..0be972b05 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.91.90.0
+1.91.91.0
diff --git a/agents-digest/gstack-AGENTS.md b/agents-digest/gstack-AGENTS.md
index d5a98806a..d5597826c 100644
--- a/agents-digest/gstack-AGENTS.md
+++ b/agents-digest/gstack-AGENTS.md
@@ -1,4 +1,4 @@
-# gstack digest v1.91.90.0 — regenerate/re-copy after upgrading gstack
+# gstack digest v1.91.91.0 — regenerate/re-copy after upgrading gstack
Behavioral rules from gstack (https://github.com/garrytan/gstack), compressed
for agent hosts without a full skill install. The full skills add workflows,
diff --git a/devex-review/SKILL.md b/devex-review/SKILL.md
index 1516fac22..6e8464788 100644
--- a/devex-review/SKILL.md
+++ b/devex-review/SKILL.md
@@ -920,9 +920,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -931,8 +930,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -941,12 +939,11 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index dad19862d..fa4c98713 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -154,8 +154,13 @@ the readiness dashboard and the PR body, and never count it as a pass.
<a id="outside-review-verdict"></a>
### How the verdict is read from a review
-- **Severity tags.** `[P0]`-`[P3]` (or Codex's native `P1:` labels). P0 and P1
- block; P2 and P3 are advisory.
+- **Severity tags.** `[P0]`-`[P3]`, Codex's native `P1:` labels, and a P0-P3
+ label at the start of a line after an optional heading, bullet, number or
+ bold: `**P1 — x**`, `**P1** — x`, `1. P2 — x`, `P2 —`, `### P1`, or a table
+ cell `| P1 |`. P0 and P1 block; P2 and P3 are advisory. A P0-P3 token in that
+ label position that none of these forms reads (`## P1/P2 findings`) makes the
+ review [`unverified`](#outside-review-unparsed-severity), never `clean`. Code
+ fences and inline code are quotes, not labels.
- **Severity words in label position.** `Severity: High`, `Priority: low`, a
line that starts with `High:`, `High —`, `[High]` or `**High**` (after an
optional heading, bullet or number), a bold `**High**` anywhere, or a table
@@ -163,9 +168,15 @@ the readiness dashboard and the PR body, and never count it as a pass.
advisory like P2 and P3. Words inside prose do not count: "high-level",
"low-risk", "a medium-term follow-up" and "no critical findings" are not
findings.
+- **Every review gate.** These rules apply to every gate that summarises a
+ review, including the `execution` gate behind `/codex` consult and challenge.
+ A reply whose last `Verdict:` line says `not ready` but carries no readable
+ severity prints `FINDINGS: unspecified` and exits 3 like a blocking finding.
- **No findings.** A review with no tag and no label is `clean` only when it
says so explicitly (`NO_FINDINGS`, "no issues", "did not find any bugs").
- Otherwise it is `unverified` (see below), never `clean`.
+ Otherwise it is `unverified` (see below), never `clean`. A `/codex` consult
+ answer with no severity labels at all is not a review summary and stays
+ `clean`.
- **Design proposals** (the design-direction voices in /design-consultation
and /office-hours) are read with the `proposal` gate: a completed proposal
needs only its `Recommendation: ... because ...` line.
@@ -312,6 +323,33 @@ no explicit no-findings conclusion, so no pass or fail can be read from it
**Fix.** Read the output above and decide. It is not a pass, and /ship and
/review list it as missing coverage.
+<a id="outside-review-unparsed-severity"></a>
+### `... outside review: ran, verdict unverified (the review labels a finding with a P0-P3 severity in a form the parser cannot read (line N: "..."))` / `REASON: unparsed_severity`
+
+**Meaning.** The reply starts a line with a P0-P3 token, the place a finding's
+label goes, but in a form gstack does not read as one severity, for example
+`## P1/P2 findings` or `- P2/P3 nits`. gstack will not guess which severity
+applies, so the verdict is unverified instead of `clean`. The quoted line in
+parentheses (also printed as `UNPARSED:`) is the first such label. When the
+same reply also has a readable P0 or P1 finding, that finding blocks
+(`VERDICT: findings`, exit 3) and the unparsed line is still printed.
+
+**What is kept.** The full reply is shown above.
+
+**Fix.** Read the quoted line and the reply, and decide; it is not a pass.
+Re-run the review and ask the reviewer to label each finding `[P1] <title>` or
+`P1: <title>`. To re-check a saved or corrected reply, run from your gstack
+checkout:
+
+```bash
+bun lib/outside-review-result.ts --verdict execution reply.md
+```
+
+(use `review` or `structured` for those gates).
+
+**Expected result.** `VERDICT: findings` or `VERDICT: clean` with a P0-P3
+`FINDINGS:` value, and no `UNPARSED:` line.
+
<a id="codex-model-unusable"></a>
### `CODEX_MODE: model_unusable` / `MODEL_UNUSABLE`
@@ -503,6 +541,32 @@ plan; the audit is `not run`.
**Expected result.** The next /ship or /review prints the audit against that plan.
+<a id="plan-eng-review-not-persisted"></a>
+### `PERSISTED: no` / `PERSIST: gstack-review-log '{...}'` / `no saved Eng Review: run the PERSIST: line ...`
+
+**Meaning.** /plan-eng-review ran where the caller forbids writes (for example
+a delegating agent keeps the reviewer read-only, so it cannot edit the plan it
+judges). The review completed: it ends `DONE` with `PERSISTED: no`, records
+telemetry `success`, and returns the full report and decision ledger in its
+reply. Nothing was saved, so /ship's readiness dashboard has no Eng Review
+record and reports NOT CLEARED with "no saved Eng Review". A real failure (a
+permitted save that failed, stale evidence) still ends `BLOCKED`.
+
+**What is kept.** The reply holds the complete report; its last line is the
+review-log command with this review's values.
+
+**Fix.** From the reviewed repository, run the reply's last line without the
+`PERSIST: ` prefix:
+
+```bash
+~/.claude/skills/gstack/bin/gstack-review-log '{"skill":"plan-eng-review",...}'
+```
+
+Or rerun /plan-eng-review where it may write its report and log.
+
+**Expected result.** `gstack-review-read` lists the `plan-eng-review` entry and
+/ship's dashboard shows the Eng Review row (CLEAR when its status is `clean`).
+
<a id="learnings-bun-missing"></a>
### `gstack-learnings-search: bun not found on PATH, so learnings could not be read. Fix: ...`
diff --git a/lib/claude-owned-journal.ts b/lib/claude-owned-journal.ts
index b11894d7f..7af90f4c2 100644
--- a/lib/claude-owned-journal.ts
+++ b/lib/claude-owned-journal.ts
@@ -12,6 +12,7 @@ import * as fs from 'node:fs';
import * as path from 'node:path';
import { createHash } from 'node:crypto';
import { isUtf8 } from 'node:buffer';
+import { isDeepStrictEqual } from 'node:util';
import { object, recordEvents, recordMeta, ownedCausalOrder, nativePathSpelling, ownedNativePath, sameNativePath,
type ClaudeParentPublicEvent, type OwnedTranscriptReason, type RecordMeta } from './claude-journal-records';
import type { PlanCountTranscript } from './claude-public-transcript';
@@ -113,6 +114,8 @@ interface Entry extends RecordMeta {
/** The message content is an array (the record can make a journal ready). */
array: boolean;
jsonResults?: string[];
+ /** Message records only: the parsed timestamp, which a post-compaction copy keeps with its type. */
+ stamp?: number;
}
interface Scanned {
@@ -148,6 +151,7 @@ function scan(fd: number, size: number, sessionId: string, prior: JournalPrefix
if (object(block) && block.type === 'tool_use' && typeof block.id === 'string') out.toolUseIds.push(block.id);
}
if (!entry.message) return;
+ entry.stamp = Date.parse(value.timestamp);
const full = recordEvents(value, true, entry.timestampValid);
entry.events = policy ? strip(full.events, policy) : full.events;
entry.slots = full.slots;
@@ -199,6 +203,27 @@ function scan(fd: number, size: number, sessionId: string, prior: JournalPrefix
return out;
}
+/**
+ * Claude Code's auto-compaction (2.1.293) writes the kept conversation again
+ * after its compact boundary: each copy has a new uuid, a relinked parentUuid
+ * and zeroed message.usage, and is otherwise identical. Read both records'
+ * bytes and compare them without those three fields.
+ */
+function compactionCopy(fd: number, original: Entry, copy: Entry): boolean {
+ const load = (entry: Entry): Record<string, any> | undefined => {
+ const bytes = Buffer.alloc(entry.length);
+ if (fs.readSync(fd, bytes, 0, entry.length, entry.offset) !== entry.length || !isUtf8(bytes)) return;
+ try {
+ const { uuid: _uuid, parentUuid: _parent, ...rest } = JSON.parse(bytes.toString('utf8'));
+ if (!object(rest.message)) return;
+ const { usage: _usage, ...message } = rest.message;
+ return { ...rest, message };
+ } catch { return; }
+ };
+ const before = load(original);
+ return before !== undefined && isDeepStrictEqual(before, load(copy));
+}
+
/** Ownership on the index, for each accepted owner directory; the first ready owner wins. */
function owned(scanned: Scanned, owners: readonly string[]) {
const results = owners.map(cwd => {
@@ -245,10 +270,23 @@ export function readOwnedClaudePublicTranscript(file: string, owners: string | r
events: [], diagnostic: { ...(scanned.claudeVersion ? { claudeVersion: scanned.claudeVersion } : {}), rootShape: ownership.shape,
toolUseIds: scanned.toolUseIds, sha256: scanned.prefix.sha256, complete: scanned.complete } };
const records: IndexedRecord[] = [];
- let base = 0, claudeVersion: string | undefined;
+ let base = 0, claudeVersion: string | undefined, compactions = 0;
+ const boundary = (entry: Entry) => entry.type === 'system' && entry.subtype === 'compact_boundary' && entry.parentNull;
+ // Message records by copy identity, each with the number of owned compact boundaries before it.
+ const earlier = ownership.order!.some(i => boundary(scanned!.entries[i]!))
+ ? new Map<string, Array<{ entry: Entry; compactions: number }>>() : undefined;
for (const i of ownership.order!) {
const entry = scanned.entries[i]!;
+ if (boundary(entry)) compactions++;
if (!entry.events) continue;
+ if (earlier) {
+ // Only a copy across a compact boundary adds no events; ancestry was already
+ // decided on the index, so records after a skipped copy stay owned.
+ const key = `${entry.type}\0${entry.stamp}`, prior = earlier.get(key) ?? [];
+ const copied = prior.some(p => p.compactions < compactions && compactionCopy(fd!, p.entry, entry));
+ prior.push({ entry, compactions }); earlier.set(key, prior);
+ if (copied) continue;
+ }
claudeVersion = entry.version ?? claudeVersion;
for (const e of entry.events) e.order += base;
records.push({ offset: entry.offset, length: entry.length, uuid: entry.uuid, base, slots: entry.slots,
diff --git a/lib/gate-outcomes.ts b/lib/gate-outcomes.ts
index c25d44082..73e04ff59 100644
--- a/lib/gate-outcomes.ts
+++ b/lib/gate-outcomes.ts
@@ -58,6 +58,11 @@ export const GATE_OUTCOMES = {
summary: 'the review completed without severity tags or an explicit no-findings line',
fix: 'read the output above and decide; it is not a pass',
},
+ unparsed_severity: {
+ state: 'ran', anchor: 'outside-review-unparsed-severity',
+ summary: 'the review labels a finding with a P0-P3 severity in a form the parser cannot read',
+ fix: 'read the quoted line and the full reply above and decide; it is not a pass. Re-run the review asking for [P0]-[P3] or "P1:" labels, or re-check a corrected reply with bun lib/outside-review-result.ts --verdict <gate> <reply-file> from your gstack checkout (https://github.com/garrytan/gstack/blob/main/docs/troubleshooting.md#outside-review-unparsed-severity)',
+ },
model_unusable: {
state: 'unavailable', anchor: 'codex-model-unusable',
summary: 'Codex could not use the selected model',
diff --git a/lib/outside-review-result.ts b/lib/outside-review-result.ts
index 446a4e745..e9871427d 100644
--- a/lib/outside-review-result.ts
+++ b/lib/outside-review-result.ts
@@ -30,6 +30,8 @@ export interface OutsideReviewClassification {
reason?: GateReason;
detail?: string;
score?: number;
+ /** A P0-P3 label the parser could not read, quoted; set beside parsed blocking findings too. */
+ unparsed?: string;
}
const REFUSAL = /\b(?:(?:I (?:cannot|can't|won't|will not|am unable to)|I'm unable to)\s+(?:review|analy[sz]e|evaluate|assess|inspect|access|complete|perform|provide|assist|help|proceed)|unable to (?:review|analy[sz]e)|I must (?:decline|refuse))\b/i;
@@ -141,10 +143,60 @@ function plainReview(text: string): string {
return text.split(/\r?\n/).map(line => line.replace(/^[\t ]*(?:#{1,6}[\t ]+|[-+*][\t ]+)?/, '').replace(/[*_`]/g, '')).join('\n');
}
+/**
+ * Code quotes text, so a severity inside a fence or an inline code span is not
+ * a label. An inline span holding only a severity token in label position
+ * (`- \`P1\`: x`, `Severity: \`High\``, a table cell) is formatting and stays.
+ */
+const CODE_LABEL_BEFORE = /^[\t ]*(?:>[\t ]*)?(?:#{1,6}[\t ]+|[-+*][\t ]+|\(?\d{1,3}[.)][\t ]+)?(?:\*\*|__)?$|\b(?:severity|priority)[\t ]*[:=][\t ]*(?:\*\*|__)?$|\|[\t ]*(?:\*\*)?$/i;
+function withoutCode(text: string): string {
+ let fence: string | undefined;
+ return text.split(/\r?\n/).map(line => {
+ const marker = /^[\t ]*(`{3,}|~{3,})/.exec(line)?.[1];
+ if (fence) {
+ if (marker && marker[0] === fence[0] && marker.length >= fence.length) fence = undefined;
+ return '';
+ }
+ if (marker) { fence = marker; return ''; }
+ return line.replace(/`([^`]+)`/g, (span, inner: string, at: number) =>
+ /^\[?(?:P[0-3]|critical|high|medium|low)\]?$/i.test(inner.trim()) && CODE_LABEL_BEFORE.test(line.slice(0, at)) ? inner : ' ');
+ }).join('\n');
+}
+
+/**
+ * P0-P3 in label position: at a line start after an optional quote, heading,
+ * bullet, number or bold, as `[P1]`, `P1:`, `P1 —`, `**P1 — x**`, `**P1** — x`,
+ * `P1 (x)` or a bare `P1` ending the line; or a table cell `| P1 |`.
+ */
+const LABEL_START = '^[\\t ]*(?:>[\\t ]*)?(?:#{1,6}[\\t ]+|[-+*][\\t ]+|\\(?\\d{1,3}[.)][\\t ]+)?(?:\\*\\*|__)?';
+const LABELED_P = new RegExp(`${LABEL_START}(?:\\[(P[0-3])\\]|(P[0-3])(?:\\*\\*|__)?[\\t ]*(?::|\u2014|\u2013|-[\\t ]|\\(|$|(?:\\*\\*|__)[\\t ]*(?::|\u2014|\u2013|-[\\t ]|$)))`, 'gm');
+const TABLE_P = /\|[\t ]*(?:\*\*)?\[?(P[0-3])\]?(?:\*\*)?[\t ]*(?=\|)/g;
+const LABEL_P = new RegExp(`${LABEL_START}\\[?P[0-3]\\b`);
+
+function severityTokens(text: string): Severity[] {
+ return [...[...text.matchAll(LABELED_P)].map(m => (m[1] ?? m[2]) as Severity),
+ ...[...text.matchAll(TABLE_P)].map(m => m[1] as Severity)];
+}
+
+/** The first line with a P0-P3 token in label position that no severity form reads. */
+function firstUnparsed(text: string): string | undefined {
+ const lines = text.split('\n');
+ const at = lines.findIndex(line => LABEL_P.test(line) && !new RegExp(LABELED_P.source, 'm').test(line));
+ return at < 0 ? undefined : `line ${at + 1}: "${lines[at]!.trim().slice(0, 160)}"`;
+}
+
+/** The reply's last `Verdict:` line says it is not ready. */
+function verdictNotReady(plain: string): boolean {
+ const last = [...plain.matchAll(/^[\t ]*Verdict[\t ]*:[\t ]*([^\r\n]*)$/gim)].at(-1)?.[1];
+ return last !== undefined && /^not[\t ]+ready\b/i.test(last.trim());
+}
+
export function classifyOutsideReview(input: OutsideReviewInput): OutsideReviewClassification {
const plain = plainReview(input.text);
- const levels = [...[...plain.matchAll(/\[(P[0-3])\]|^(P[0-3]):/gm)].map(m => (m[1] ?? m[2]) as Severity),
- ...(input.gate === 'review' || input.gate === 'structured' ? severityWords(input.text) : [])];
+ const reviewed = input.gate !== 'proposal';
+ const code = withoutCode(input.text), plainCode = plainReview(code);
+ const levels = [...[...plainCode.matchAll(/\[(P[0-3])\]|^(P[0-3]):/gm)].map(m => (m[1] ?? m[2]) as Severity),
+ ...severityTokens(code), ...(reviewed ? severityWords(code) : [])];
const findings = { highest: levels.length ? levels.sort()[0]! : null };
const ran = execution(input);
if (ran.state === 'unavailable') return { execution: ran, findings, verdict: 'unavailable', reason: ran.reason, detail: ran.detail };
@@ -161,10 +213,15 @@ export function classifyOutsideReview(input: OutsideReviewInput): OutsideReviewC
if ((input.gate === 'review' || input.gate === 'proposal') && !/^Recommendation:[\t ]*[^\r\n]+\bbecause\b[\t ]*\S[^\r\n]+$/im.test(plain)) {
return result('unavailable', 'missing_markers', 'missing review completion recommendation');
}
+ if (!reviewed) return result(blocking ? 'findings' : 'clean');
+ const unparsed = firstUnparsed(code);
+ const notReady = !findings.highest && verdictNotReady(plainCode);
+ if (blocking || notReady) return { ...result('findings'), ...(unparsed ? { unparsed } : {}) };
+ if (unparsed) return { ...result('unverified', 'unparsed_severity', unparsed), unparsed };
if ((input.gate === 'structured' || input.gate === 'review') && !findings.highest && !NO_FINDINGS.test(input.text)) {
return result('unverified', 'untagged_review', 'missing severity or explicit no-findings conclusion');
}
- return result(blocking ? 'findings' : 'clean');
+ return result('clean');
}
const LEGACY_REASONS: Partial<Record<GateReason, string>> = {
@@ -224,11 +281,16 @@ if (import.meta.main) {
}
const checked = classifyOutsideReview({ text, gate: gate as OutsideGate, exit,
stderr: await readOptional(flags['--stderr']), events: await readOptional(flags['--events']) });
+ const label = flags['--label'] ?? 'Outside review';
console.log(`VERDICT: ${checked.verdict}`);
- console.log(`FINDINGS: ${checked.findings.highest ?? 'none'}`);
+ console.log(`FINDINGS: ${checked.findings.highest ?? (checked.verdict === 'findings' ? 'unspecified' : 'none')}`);
+ if (checked.unparsed) console.log(`UNPARSED: ${checked.unparsed}`);
if (checked.reason) {
console.log(`REASON: ${checked.reason}`);
- console.error(gateOutcomeLine(flags['--label'] ?? 'Outside review', checked.reason, checked.detail));
+ console.error(gateOutcomeLine(label, checked.reason, checked.detail));
+ } else if (checked.unparsed) {
+ const outcome = GATE_OUTCOMES.unparsed_severity;
+ console.error(`${label}: findings block this review; separately, ${outcome.summary} (${checked.unparsed}). Fix: ${outcome.fix}.`);
}
process.exit(VERDICT_EXIT[checked.verdict]);
}
diff --git a/package.json b/package.json
index 8b6d55e4b..2a513245e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gstack",
- "version": "1.91.90",
+ "version": "1.91.91",
"description": "Garry's Stack — Claude Code skills + fast headless browser. One repo, one install, entire AI engineering workflow.",
"license": "MIT",
"type": "module",
diff --git a/plan-ceo-review/sections/review-sections.md b/plan-ceo-review/sections/review-sections.md
index d319bb336..5012795cb 100644
--- a/plan-ceo-review/sections/review-sections.md
+++ b/plan-ceo-review/sections/review-sections.md
@@ -1058,9 +1058,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -1069,8 +1068,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -1079,12 +1077,11 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
diff --git a/plan-design-review/sections/review-sections.md b/plan-design-review/sections/review-sections.md
index 9bf94bee2..5e034194c 100644
--- a/plan-design-review/sections/review-sections.md
+++ b/plan-design-review/sections/review-sections.md
@@ -568,9 +568,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -579,8 +578,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -589,12 +587,11 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
diff --git a/plan-devex-review/sections/review-sections.md b/plan-devex-review/sections/review-sections.md
index 53aff496f..fd1187c66 100644
--- a/plan-devex-review/sections/review-sections.md
+++ b/plan-devex-review/sections/review-sections.md
@@ -868,9 +868,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -879,8 +878,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -889,12 +887,11 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
diff --git a/plan-eng-review/SKILL.md b/plan-eng-review/SKILL.md
index 793561bc0..a5ba64b45 100644
--- a/plan-eng-review/SKILL.md
+++ b/plan-eng-review/SKILL.md
@@ -660,6 +660,8 @@ follow **Blocked outcome** first; then resume here.
**Blocked outcome:** Stop the review and report `BLOCKED`, the missing path/work, actual attempts and what is needed to resume. Label complete chat-only output **not persisted**; it supplies no saved-review or completion credit. If startup values and a permitted telemetry command are available, run **Telemetry (run last)** once with `OUTCOME=error` and the actual `ERROR_MESSAGE`/`FAILED_STEP`. Do not call ExitPlanMode. Resume at the failed step using Recovery routing.
+**Report-back outcome:** The caller forbids the report file or required Review Log. Present Required outputs steps 1 and 4 as **not persisted**; skip navigation, Read-back, the EXIT PLAN MODE GATE and ExitPlanMode. Run permitted **Telemetry (run last)** with `OUTCOME=success`. Report `DONE` and `PERSISTED: no`; the last line is `PERSIST: ` plus the filled `gstack-review-log` command for the caller to run. No saved-review credit until then.
+
## Section self-check (before you finish)
Confirm you read the section and completed Scope Challenge, Sections 1–4,
@@ -668,12 +670,12 @@ and use Recovery routing above. Preserve verified work.
## EXIT PLAN MODE GATE (BLOCKING)
-Run this final verification for every review target, in every host mode. It
-checks the completed work; only the later ExitPlanMode call is plan-mode-only.
+Run this for every review target in every host mode; only the later
+ExitPlanMode call is plan-mode-only.
-Confirm Approval readiness passed for the current decisions. This is a
-read-only verification, not a new approval or output-writing step. If it is
-stale, report the stale verification and stop before success telemetry;
+Confirm Approval readiness passed for the current decisions; this read-only
+verification is not an approval or a write. If stale, report the stale
+verification and stop before success telemetry;
follow **Blocked outcome**. Resume under **Recovery routing → Late change or missing work**.
Verify all five checks against the selected report file:
@@ -687,7 +689,7 @@ Verify all five checks against the selected report file:
5. Confirm `gstack-review-log` was called and `gstack-review-read` ran at
least once for the completed saved review.
-Apply **Review record and write policy**: forbidden report/log persistence or
+Forbidden report/log persistence uses **Report-back outcome**, not this gate;
an unrecovered save cannot pass. If any check fails, follow **Blocked outcome**
without success telemetry or ExitPlanMode. Body prose cannot replace the
separate terminal structured report.
diff --git a/plan-eng-review/SKILL.md.tmpl b/plan-eng-review/SKILL.md.tmpl
index a82a37e39..954b35101 100644
--- a/plan-eng-review/SKILL.md.tmpl
+++ b/plan-eng-review/SKILL.md.tmpl
@@ -174,6 +174,8 @@ follow **Blocked outcome** first; then resume here.
**Blocked outcome:** Stop the review and report `BLOCKED`, the missing path/work, actual attempts and what is needed to resume. Label complete chat-only output **not persisted**; it supplies no saved-review or completion credit. If startup values and a permitted telemetry command are available, run **Telemetry (run last)** once with `OUTCOME=error` and the actual `ERROR_MESSAGE`/`FAILED_STEP`. Do not call ExitPlanMode. Resume at the failed step using Recovery routing.
+**Report-back outcome:** The caller forbids the report file or required Review Log. Present Required outputs steps 1 and 4 as **not persisted**; skip navigation, Read-back, the EXIT PLAN MODE GATE and ExitPlanMode. Run permitted **Telemetry (run last)** with `OUTCOME=success`. Report `DONE` and `PERSISTED: no`; the last line is `PERSIST: ` plus the filled `gstack-review-log` command for the caller to run. No saved-review credit until then.
+
## Section self-check (before you finish)
Confirm you read the section and completed Scope Challenge, Sections 1–4,
diff --git a/plan-eng-review/sections/review-sections.md b/plan-eng-review/sections/review-sections.md
index cd7d5c511..6a7fafe5f 100644
--- a/plan-eng-review/sections/review-sections.md
+++ b/plan-eng-review/sections/review-sections.md
@@ -37,10 +37,10 @@ path authorizes no other; implementation edits require explicit authority.
| Artifact | Destination | If writing is forbidden |
|---|---|---|
-| Working plan, ledger and complete review report | Selected report file | Ask for a permitted destination if the user can supply one; wait without completion telemetry. If none is permitted, follow **Read-only review** below, then use **Blocked outcome**. |
+| Working plan, ledger and complete review report | Selected report file | Ask for a permitted destination if the user can supply one; wait without completion telemetry. If none is permitted, use **Read-only review** below, then **Report-back outcome**. |
| QA Test Plan and task JSONL | Discovery paths below | Present each completely as **not persisted** and continue. |
| TODOS.md | The project's TODO file | Present accepted TODO content as **not persisted** and continue. |
-| Required Review Log | The helper's state location | Present its fields as **not persisted**; at Review Log, use **Blocked outcome** instead of publishing a saved review. The final gate cannot pass without this log. |
+| Required Review Log | The helper's state location | Present its fields as **not persisted**; at Review Log, use **Report-back outcome** instead of publishing a saved review. The final gate cannot pass without this log. |
| Best-effort metadata/learning logs | Helper-defined locations | Skip forbidden writes; otherwise keep their best-effort behavior. |
QA Test Plan/task JSONL keep discovery paths `$GSTACK_STATE_ROOT/projects/{slug}/`:
@@ -1108,10 +1108,11 @@ must pass steps 1–4 again.
if later approved decisions changed its requirements. Do not recreate unchanged output.
2. **Save and Read back.** Use Plan File Review Report to save the complete body
and terminal `## GSTACK REVIEW REPORT`; pass its Read-back gate. Forbidden
- persistence or an unrecovered save requires **Blocked outcome**, not logging.
+ persistence uses **Report-back outcome**; an unrecovered save requires
+ **Blocked outcome**, not logging.
3. **Log the saved review.** Run Review Log with saved Completion summary values.
- If the required log is forbidden, show fields as not persisted and take **Blocked outcome**;
- failures use the write policy's recovery. Neither supplies completion or saved-dashboard credit.
+ If the required log is forbidden, show fields as not persisted and take **Report-back outcome**;
+ failures use the write policy's recovery.
4. **Publish.** Display the Review Readiness Dashboard, then present the saved
Completion summary to the user.
5. **Choose navigation.** Use Next Steps — Review Chaining; wait for its answer.
@@ -1329,7 +1330,7 @@ DROP the current skill's row; emit the sentinel only when both are zero.
### Write to the report file
-If the report destination is absent or writing is forbidden, assemble the same complete working plan, review output and terminal report in chat, labeled not persisted. Do not run the file-writing steps below or claim their Read-back gate passed. Then follow **Blocked outcome** in the entrypoint. Otherwise save only accepted changes, keeping unresolved choices pending:
+If the report destination is absent or writing is forbidden, assemble the same complete working plan, review output and terminal report in chat, labeled not persisted. Do not run the file-writing steps below or claim their Read-back gate passed. Then use **Report-back outcome**. Otherwise save only accepted changes, keeping unresolved choices pending:
The report must always be the LAST section of the report file — never mid-file.
Use a single delete-then-append flow:
@@ -1401,9 +1402,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -1412,8 +1412,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -1422,12 +1421,11 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
diff --git a/plan-eng-review/sections/review-sections.md.tmpl b/plan-eng-review/sections/review-sections.md.tmpl
index d0441d08e..737e3db37 100644
--- a/plan-eng-review/sections/review-sections.md.tmpl
+++ b/plan-eng-review/sections/review-sections.md.tmpl
@@ -35,10 +35,10 @@ path authorizes no other; implementation edits require explicit authority.
| Artifact | Destination | If writing is forbidden |
|---|---|---|
-| Working plan, ledger and complete review report | Selected report file | Ask for a permitted destination if the user can supply one; wait without completion telemetry. If none is permitted, follow **Read-only review** below, then use **Blocked outcome**. |
+| Working plan, ledger and complete review report | Selected report file | Ask for a permitted destination if the user can supply one; wait without completion telemetry. If none is permitted, use **Read-only review** below, then **Report-back outcome**. |
| QA Test Plan and task JSONL | Discovery paths below | Present each completely as **not persisted** and continue. |
| TODOS.md | The project's TODO file | Present accepted TODO content as **not persisted** and continue. |
-| Required Review Log | The helper's state location | Present its fields as **not persisted**; at Review Log, use **Blocked outcome** instead of publishing a saved review. The final gate cannot pass without this log. |
+| Required Review Log | The helper's state location | Present its fields as **not persisted**; at Review Log, use **Report-back outcome** instead of publishing a saved review. The final gate cannot pass without this log. |
| Best-effort metadata/learning logs | Helper-defined locations | Skip forbidden writes; otherwise keep their best-effort behavior. |
QA Test Plan/task JSONL keep discovery paths `$GSTACK_STATE_ROOT/projects/{slug}/`:
@@ -475,10 +475,11 @@ must pass steps 1–4 again.
if later approved decisions changed its requirements. Do not recreate unchanged output.
2. **Save and Read back.** Use Plan File Review Report to save the complete body
and terminal `## GSTACK REVIEW REPORT`; pass its Read-back gate. Forbidden
- persistence or an unrecovered save requires **Blocked outcome**, not logging.
+ persistence uses **Report-back outcome**; an unrecovered save requires
+ **Blocked outcome**, not logging.
3. **Log the saved review.** Run Review Log with saved Completion summary values.
- If the required log is forbidden, show fields as not persisted and take **Blocked outcome**;
- failures use the write policy's recovery. Neither supplies completion or saved-dashboard credit.
+ If the required log is forbidden, show fields as not persisted and take **Report-back outcome**;
+ failures use the write policy's recovery.
4. **Publish.** Display the Review Readiness Dashboard, then present the saved
Completion summary to the user.
5. **Choose navigation.** Use Next Steps — Review Chaining; wait for its answer.
diff --git a/scripts/resolvers/plan-gates.ts b/scripts/resolvers/plan-gates.ts
index 3e7de2a46..e71405b94 100644
--- a/scripts/resolvers/plan-gates.ts
+++ b/scripts/resolvers/plan-gates.ts
@@ -88,12 +88,12 @@ Failed checks use **Gate outcome: Blocked**. Chat or body prose cannot replace
the verified terminal report. Do not call ExitPlanMode until all checks pass.`;
if (ctx.skillName === 'plan-eng-review') return `## EXIT PLAN MODE GATE (BLOCKING)
-Run this final verification for every review target, in every host mode. It
-checks the completed work; only the later ExitPlanMode call is plan-mode-only.
+Run this for every review target in every host mode; only the later
+ExitPlanMode call is plan-mode-only.
-Confirm Approval readiness passed for the current decisions. This is a
-read-only verification, not a new approval or output-writing step. If it is
-stale, report the stale verification and stop before success telemetry;
+Confirm Approval readiness passed for the current decisions; this read-only
+verification is not an approval or a write. If stale, report the stale
+verification and stop before success telemetry;
follow **Blocked outcome**. Resume under **Recovery routing → Late change or missing work**.
Verify all five checks against the selected report file:
@@ -107,7 +107,7 @@ Verify all five checks against the selected report file:
5. Confirm \`gstack-review-log\` was called and \`gstack-review-read\` ran at
least once for the completed saved review.
-Apply **Review record and write policy**: forbidden report/log persistence or
+Forbidden report/log persistence uses **Report-back outcome**, not this gate;
an unrecovered save cannot pass. If any check fails, follow **Blocked outcome**
without success telemetry or ExitPlanMode. Body prose cannot replace the
separate terminal structured report.`;
diff --git a/scripts/resolvers/review-dashboard.ts b/scripts/resolvers/review-dashboard.ts
index b90183ff4..89a6c1a73 100644
--- a/scripts/resolvers/review-dashboard.ts
+++ b/scripts/resolvers/review-dashboard.ts
@@ -8,7 +8,7 @@ import { type TemplateContext } from './types';
export function generateReviewDashboard(ctx: TemplateContext): string {
const result = `## Review Readiness Dashboard
-${ctx.skillName === 'ship' ? 'During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.' : 'After completing the review, read the review log and config to display the dashboard.'}
+${ctx.skillName === 'ship' ? 'In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.' : 'After completing the review, read the review log and config to display the dashboard.'}
\`\`\`bash
~/.claude/skills/gstack/bin/gstack-review-read
@@ -31,9 +31,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded \`via\` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without \`via\`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group \`autoplan-voices\`
+**Source attribution:** Append a recorded \`via\` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group \`autoplan-voices\`
and \`design-outside-voices\` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -42,8 +41,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For \`review\`, \`adversarial-review\`, \`codex-review\`,
ship-stage reviews and \`design-review-lite\`, use \`review_freshness.status\`
and show its \`reason\`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current \`---WTREE---\` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current \`---WTREE---\` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing \`review_freshness\`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -52,16 +50,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If \`plan_sha256\` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with \`---HEAD---\`.
- If different, run \`git rev-list --count STORED_COMMIT..HEAD\` and report
+ Compare the recorded commit with \`---HEAD---\`; if different, run
+ \`git rev-list --count STORED_COMMIT..HEAD\` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be \`clean\`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If \`skip_eng_review\` is true, show
+and its missing, stale or open-issue reason.${ctx.skillName === 'ship' ? ` With no Eng Review record, say "no saved Eng Review: run the \`PERSIST:\` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted).` : ''} If \`skip_eng_review\` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
${ctx.skillName === 'ship' ? 'This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.' : 'Eng Review is required by default; `gstack-config set skip_eng_review true` disables that requirement.'}
@@ -206,7 +203,7 @@ DROP the current skill's row; emit the sentinel only when both are zero.`}
### Write to the ${reviewFile}
-${beforeLog ? (conditionalWrites ? `${ceo ? 'If no destination is selected' : 'If the report destination is absent'} or writing is forbidden, assemble the same complete ${eng ? 'working plan' : 'plan'}, review output and terminal report in chat, labeled not persisted. Do not run the file-writing steps below or claim their Read-back gate passed.${ctx.skillName === 'plan-eng-review' ? ' Then follow **Blocked outcome** in the entrypoint.' : " Follow Stage 3's blocked chat return; no completed-review log or handoff."} Otherwise save only accepted changes, keeping unresolved choices pending:` : '**PLAN MODE EXCEPTION — ALWAYS RUN:** Save the complete reviewed plan/report with only accepted changes applied; keep unresolved choices pending.') : `**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
+${beforeLog ? (conditionalWrites ? `${ceo ? 'If no destination is selected' : 'If the report destination is absent'} or writing is forbidden, assemble the same complete ${eng ? 'working plan' : 'plan'}, review output and terminal report in chat, labeled not persisted. Do not run the file-writing steps below or claim their Read-back gate passed.${ctx.skillName === 'plan-eng-review' ? ' Then use **Report-back outcome**.' : " Follow Stage 3's blocked chat return; no completed-review log or handoff."} Otherwise save only accepted changes, keeping unresolved choices pending:` : '**PLAN MODE EXCEPTION — ALWAYS RUN:** Save the complete reviewed plan/report with only accepted changes applied; keep unresolved choices pending.') : `**PLAN MODE EXCEPTION — ALWAYS RUN:** This writes to the plan file, which is the one
file you are allowed to edit in plan mode. The plan file review report is part of the
plan's living status.`}
diff --git a/ship/SKILL.md b/ship/SKILL.md
index d997d2c1b..39ca8aa00 100644
--- a/ship/SKILL.md
+++ b/ship/SKILL.md
@@ -581,7 +581,7 @@ repository-landing asks, including on Apple repos.
## Review Readiness Dashboard
-During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.
+In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.
```bash
~/.claude/skills/gstack/bin/gstack-review-read
@@ -604,9 +604,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -615,8 +614,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -625,16 +623,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If `skip_eng_review` is true, show
+and its missing, stale or open-issue reason. With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted). If `skip_eng_review` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.
diff --git a/test/autoplan-compaction-copies.test.ts b/test/autoplan-compaction-copies.test.ts
new file mode 100644
index 000000000..5e698ac0d
--- /dev/null
+++ b/test/autoplan-compaction-copies.test.ts
@@ -0,0 +1,176 @@
+/**
+ * #3107: after a Claude Code 2.1.293 auto-compaction the journal holds a
+ * compact boundary followed by copies of the kept conversation: a new uuid, a
+ * parentUuid relinked to the previous copy (a tool_result copy keeps its
+ * original parent), zeroed message.usage, every other field identical. The
+ * owned reader collapses such a copy into its pre-boundary original; any other
+ * difference, or a duplicate with no boundary between, still fails closed.
+ */
+import { afterEach, describe, expect, test } from 'bun:test';
+import * as fs from 'node:fs';
+import { randomUUID } from 'node:crypto';
+import { guardFixture, section, codeOf, denial, type GuardFixture } from './helpers/autoplan-guard-fixture';
+import { readOwnedClaudePublicTranscript } from '../lib/claude-public-transcript';
+import { OWNED_READ_APPROVAL } from '../autoplan/bin/owned-read';
+
+type Row = Record<string, any>;
+const fixtures: GuardFixture[] = [];
+afterEach(() => { for (const f of fixtures.splice(0)) f.cleanup(); });
+const fixture = (...args: Parameters<typeof guardFixture>) => { const f = guardFixture(...args); fixtures.push(f); return f; };
+
+const rowsOf = (f: GuardFixture): Row[] => fs.readFileSync(f.transcript, 'utf8').trim().split('\n').map(line => JSON.parse(line));
+const write = (f: GuardFixture, rows: Row[]) => fs.writeFileSync(f.transcript, rows.map(r => JSON.stringify(r)).join('\n') + '\n');
+const toolResult = (r: Row) => r.message?.role === 'user' && Array.isArray(r.message.content) && r.message.content[0]?.type === 'tool_result';
+const toolUse = (r: Row) => r.message?.role === 'assistant' && Array.isArray(r.message.content) && r.message.content.some((b: Row) => b.type === 'tool_use');
+/** What 2.1.293 keeps in full: prompts, assistant text and end turns, plus the last `tools` tool calls. */
+const kept = (tools: number) => (rows: Row[]) => {
+ const uses = rows.filter(toolUse).slice(rows.filter(toolUse).length - tools)
+ .flatMap(r => r.message.content.filter((b: Row) => b.type === 'tool_use').map((b: Row) => b.id));
+ return rows.filter(r => !(toolUse(r) || toolResult(r)) || r.message.content.some((b: Row) => uses.includes(b.id ?? b.tool_use_id)));
+};
+
+/** Give every assistant record real usage, as Claude Code writes it before a compaction. */
+function withUsage(f: GuardFixture): void {
+ write(f, rowsOf(f).map(r => r.message?.role === 'assistant'
+ ? { ...r, message: { ...r.message, usage: { input_tokens: 812, output_tokens: 64, cache_read_input_tokens: 4096 } } } : r));
+}
+
+/**
+ * Append a 2.1.293-shaped compaction: the boundary, then copies of `select(rows)`
+ * (the message records since the last boundary, by default all of them).
+ */
+function compact(f: GuardFixture, opts: { select?: (rows: Row[]) => Row[]; boundary?: boolean; change?: (copy: Row) => void } = {}): Row[] {
+ const rows = rowsOf(f), last = rows.at(-1)!;
+ const since = rows.slice(rows.findLastIndex(r => r.subtype === 'compact_boundary') + 1).filter(r => r.message);
+ const boundary = { parentUuid: null, logicalParentUuid: last.uuid, isSidechain: false, cwd: last.cwd, sessionId: last.sessionId,
+ version: last.version, type: 'system', subtype: 'compact_boundary', content: 'Conversation compacted', isMeta: false,
+ timestamp: new Date(Date.parse(last.timestamp) + 1000).toISOString(), uuid: randomUUID(),
+ compactMetadata: { trigger: 'auto', preTokens: 975885, postTokens: 52538 } };
+ const out = opts.boundary === false ? [...rows] : [...rows, boundary];
+ let parent = opts.boundary === false ? last.uuid : boundary.uuid;
+ const copies: Row[] = [];
+ for (const original of (opts.select ?? (r => r))(since)) {
+ const copy = structuredClone(original);
+ copy.uuid = randomUUID();
+ if (!toolResult(original)) copy.parentUuid = parent;
+ if (copy.message.usage) copy.message.usage = { input_tokens: 0, output_tokens: 0, cache_read_input_tokens: 0 };
+ opts.change?.(copy);
+ parent = copy.uuid; copies.push(copy); out.push(copy);
+ }
+ write(f, out);
+ return copies;
+}
+
+/** Journal the phase-entry Read under the last record, so the hook takes the journal path. */
+function enterNext(f: GuardFixture) {
+ const rows = rowsOf(f), last = rows.at(-1)!;
+ const input = f.input('next', 'Read', { file_path: section('design-phase.md') });
+ rows.push({ ...last, uuid: randomUUID(), parentUuid: last.uuid, type: 'assistant', toolUseResult: undefined, isMeta: undefined,
+ origin: undefined, promptId: undefined, promptSource: undefined, timestamp: new Date(Date.parse(last.timestamp) + 1000).toISOString(),
+ message: { role: 'assistant', id: f.nextMessage(), content: [{ type: 'tool_use', id: 'next', name: 'Read', input: input.tool_input }] } });
+ write(f, rows);
+ return input;
+}
+
+const events = (f: GuardFixture) => readOwnedClaudePublicTranscript(f.transcript, f.cwd, f.sessionId).events;
+const identities = (f: GuardFixture) => events(f).filter(e => e.kind === 'use' || e.kind === 'result').map(e => `${e.kind}:${(e as any).toolUseId}`);
+
+describe('#3107 post-compaction copies', () => {
+ test('a synthesized 2.1.293 post-compaction journal passes; the copies add no events', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ const before = events(f).length;
+ const copies = compact(f);
+ expect(copies.length).toBeGreaterThan(8);
+ expect(copies.filter(toolResult).every(c => rowsOf(f).some(r => r.uuid === c.parentUuid && !copies.includes(r)))).toBe(true);
+ expect(events(f)).toHaveLength(before);
+ expect(new Set(identities(f)).size).toBe(identities(f).length);
+ expect(events(f).filter(e => e.kind === 'user_turn')).toHaveLength(1);
+ // The phase entry hangs under the last copy: ancestry through skipped copies stays owned.
+ expect(await f.hook(enterNext(f))).toEqual(OWNED_READ_APPROVAL);
+ });
+
+ test('the payload path (phase entry not yet journaled) passes after copies of the last three tool calls', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f); compact(f, { select: kept(3) });
+ expect(await f.hook(f.input('next', 'Read', { file_path: section('design-phase.md') }))).toEqual(OWNED_READ_APPROVAL);
+ });
+
+ test('a copy whose tool result changed still fails tool_identity', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ compact(f, { change: c => { if (toolResult(c) && c.message.content[0].tool_use_id === 'close') c.message.content[0].content = 'A different result.'; } });
+ expect(identities(f).filter(id => id === 'result:close')).toHaveLength(2);
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('tool_identity');
+ });
+
+ test('a copy whose tool input changed still fails tool_identity', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ compact(f, { change: c => { if (toolUse(c) && c.message.content[0].id === 'entry') c.message.content[0].input = { ...c.message.content[0].input, limit: 1 }; } });
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('tool_identity');
+ });
+
+ test('a duplicate identity with no compact boundary between the records still fails tool_identity', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ compact(f, { boundary: false, select: kept(3) });
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('tool_identity');
+ });
+
+ test('a copy differing only in another field (here isMeta) is kept and fails closed', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ compact(f, { select: kept(3), change: c => { if (toolResult(c)) c.isMeta = true; } });
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('tool_identity');
+ });
+
+ test('a copied /autoplan prompt does not re-initialize the guard (no init_own)', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ compact(f, { select: kept(0) });
+ expect(rowsOf(f).filter(r => typeof r.message?.content === 'string' && r.message.content.includes('/autoplan'))).toHaveLength(2);
+ expect(events(f).filter(e => e.kind === 'user_turn')).toHaveLength(1);
+ expect(await f.hook(enterNext(f))).toEqual(OWNED_READ_APPROVAL);
+ });
+
+ test('a copied end turn with its typed prompt does not disarm the guard', async () => {
+ const f = fixture('ceo', { opening: 'skill' });
+ // Earlier work ended its turn before the typed request that ran /autoplan; the Phase 1 report is not published.
+ f.journal(undefined, at => at === -1 ? [
+ { type: 'user', message: { role: 'user', content: 'Earlier work in this session.' }, extra: { origin: { kind: 'human' }, promptSource: 'typed', promptId: randomUUID() } },
+ { type: 'assistant', message: { role: 'assistant', id: 'msg_earlier', content: [{ type: 'text', text: 'Done with the earlier work.' }], stop_reason: 'end_turn' } },
+ ] : []);
+ withUsage(f);
+ expect(codeOf(await f.hook(f.input('next', 'Read', { file_path: section('design-phase.md') })))).toBe('publication_missing');
+ compact(f, { select: kept(0) });
+ expect(events(f).filter(e => e.kind === 'end_turn')).toHaveLength(1);
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('publication_missing');
+ });
+
+ test('a double compaction collapses copies of copies', async () => {
+ const f = fixture(); f.publish(); f.journal(); withUsage(f);
+ const before = events(f).length;
+ compact(f); compact(f);
+ expect(rowsOf(f).filter(r => r.subtype === 'compact_boundary')).toHaveLength(2);
+ expect(events(f)).toHaveLength(before);
+ expect(await f.hook(enterNext(f))).toEqual(OWNED_READ_APPROVAL);
+ });
+});
+
+describe('the fail-open disarm path (phase-publication-hook disarmedAt)', () => {
+ test('a real end turn and a later typed request release the invocation; the guard allows and logs it', async () => {
+ const f = fixture(); f.journal();
+ const unpublished = await f.hook(f.input('next', 'Read', { file_path: section('design-phase.md') }));
+ expect(codeOf(unpublished)).toBe('publication_missing');
+ const rows = rowsOf(f), last = rows.at(-1)!;
+ const end = { ...last, uuid: randomUUID(), parentUuid: last.uuid, type: 'assistant', toolUseResult: undefined,
+ message: { role: 'assistant', id: f.nextMessage(), content: [{ type: 'text', text: 'Stopping here.' }], stop_reason: 'end_turn' } };
+ const typed = { ...last, uuid: randomUUID(), parentUuid: end.uuid, type: 'user', toolUseResult: undefined,
+ origin: { kind: 'human' }, promptSource: 'typed', promptId: randomUUID(), message: { role: 'user', content: 'Read the design section for me.' } };
+ write(f, [...rows, end, typed]);
+ expect(denial(await f.hook(enterNext(f)))).toBeUndefined();
+ expect(f.log().at(-1)).toMatchObject({ decision: 'allow' });
+ });
+
+ test('the same end turn without a later typed request keeps the guard armed', async () => {
+ const f = fixture(); f.journal();
+ const rows = rowsOf(f), last = rows.at(-1)!;
+ write(f, [...rows, { ...last, uuid: randomUUID(), parentUuid: last.uuid, type: 'assistant', toolUseResult: undefined,
+ message: { role: 'assistant', id: f.nextMessage(), content: [{ type: 'text', text: 'Stopping here.' }], stop_reason: 'end_turn' } }]);
+ expect(codeOf(await f.hook(enterNext(f)))).toBe('publication_missing');
+ });
+});
diff --git a/test/eng-review-routing.test.ts b/test/eng-review-routing.test.ts
index f1c885a14..082959b7c 100644
--- a/test/eng-review-routing.test.ts
+++ b/test/eng-review-routing.test.ts
@@ -5,6 +5,8 @@ import { generateBrainWriteBack } from '../scripts/resolvers/gbrain';
import { generateAskUserFormat } from '../scripts/resolvers/preamble/generate-ask-user-format';
import { generateTestCoverageAuditPlan, generateTestCoverageAuditShip } from '../scripts/resolvers/testing';
import { HOST_PATHS, type TemplateContext } from '../scripts/resolvers/types';
+import { generateReviewDashboard, generatePlanFileReviewReport } from '../scripts/resolvers/review-dashboard';
+import { generateExitPlanModeGate } from '../scripts/resolvers/plan-gates';
import { ENG_REVIEW_EXCERPT } from './helpers/workflow-excerpt';
import { expectMentions } from './helpers/prompt-structure';
@@ -125,8 +127,40 @@ describe('engineering review routing contracts', () => {
const policy = compact(between(section, '## Review record and write policy', '{{LEARNINGS_SEARCH}}'));
expect(policy).toContain('**Recovery routing → Repairable write/read failure**');
expect(policy).toMatch(/skip forbidden writes/i);
- expect(recovery).toContain('`OUTCOME=error`');
- expect(recovery).not.toContain('`OUTCOME=success`');
+ const blocked = between(recovery, '**Blocked outcome:**', '**Report-back outcome:**');
+ expect(blocked).toContain('`OUTCOME=error`');
+ expect(blocked).not.toContain('`OUTCOME=success`');
+ });
+
+ test('#3106: a caller-forbidden write reports back as DONE with PERSISTED: no and a final PERSIST: line', () => {
+ const back = compact(recovery.slice(recovery.indexOf('**Report-back outcome:**')));
+ ordered(back, ['caller forbids the report file or required Review Log', 'as **not persisted**',
+ 'skip navigation, Read-back, the EXIT PLAN MODE GATE and ExitPlanMode', '`OUTCOME=success`', 'Report `DONE` and `PERSISTED: no`',
+ 'the last line is `PERSIST: `', 'filled `gstack-review-log` command', 'No saved-review credit until then']);
+ expect(back).not.toContain('BLOCKED');
+ expect(back).not.toMatch(/REPORTED|DONE_WITH/);
+ const blocked = compact(between(recovery, '**Blocked outcome:**', '**Report-back outcome:**'));
+ expect(blocked).toContain('report `BLOCKED`');
+ const routes = compact(between(section, '| Artifact | Destination | If writing is forbidden |', 'QA Test Plan/task JSONL keep'));
+ expect(routes).toContain('use **Read-only review** below, then **Report-back outcome**.');
+ expect(routes).toContain('at Review Log, use **Report-back outcome** instead of publishing a saved review');
+ const finish = compact(between(section, '## Required outputs', '### Output reference'));
+ expect(finish).toContain('Forbidden persistence uses **Report-back outcome**; an unrecovered save requires **Blocked outcome**, not logging.');
+ expect(finish).toContain('If the required log is forbidden, show fields as not persisted and take **Report-back outcome**');
+ });
+
+ test('#3106: an unpersisted review gets no saved credit; /ship names the PERSIST: line or a rerun', () => {
+ const ctx = (skillName: string) => ({ skillName, tmplPath: `${skillName}/SKILL.md.tmpl`, host: 'claude', paths: HOST_PATHS.claude } as TemplateContext);
+ const ship = compact(generateReviewDashboard(ctx('ship')));
+ expect(ship).toContain('With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it"');
+ expect(ship).toContain('docs/troubleshooting.md#plan-eng-review-not-persisted');
+ expect(generateReviewDashboard(ctx('plan-eng-review'))).not.toContain('PERSIST:');
+ const gate = compact(generateExitPlanModeGate(ctx('plan-eng-review')));
+ expect(gate).toContain('Forbidden report/log persistence uses **Report-back outcome**, not this gate; an unrecovered save cannot pass');
+ const writer = compact(generatePlanFileReviewReport(ctx('plan-eng-review')));
+ expect(writer).toContain('Then use **Report-back outcome**.');
+ expect(writer).toMatch(/follow \*\*Blocked outcome\*\* before Review Log or decision logging/);
+ expect(readFileSync('docs/troubleshooting.md', 'utf8')).toContain('<a id="plan-eng-review-not-persisted"></a>');
});
test('late changes rerun affected approvals and outputs before another navigation answer', () => {
diff --git a/test/eng-scope-entry-ap.test.ts b/test/eng-scope-entry-ap.test.ts
index a18d6704b..9989b2f67 100644
--- a/test/eng-scope-entry-ap.test.ts
+++ b/test/eng-scope-entry-ap.test.ts
@@ -128,7 +128,7 @@ test('the full evaluated bundle routes startup into ordered preparation before s
expect(policy).toContain('| QA Test Plan and task JSONL | Discovery paths below | Present each completely as **not persisted** and continue. |');
expect(policy).toContain('| Best-effort metadata/learning logs | Helper-defined locations | Skip forbidden writes; otherwise keep their best-effort behavior. |');
const finish = section.slice(section.indexOf('## Required outputs'), section.indexOf('### Output reference'));
- expect(finish.replace(/\s+/g, ' ')).toMatch(/required log is forbidden, show fields as not persisted and take \*\*Blocked outcome\*\*/i);
+ expect(finish.replace(/\s+/g, ' ')).toMatch(/required log is forbidden, show fields as not persisted and take \*\*Report-back outcome\*\*/i);
const log = section.slice(section.indexOf('## Review Log'), section.indexOf('## Next Steps'));
expect(log).toContain("' || exit $?");
expect(log).toContain("' 2>/dev/null || true");
diff --git a/test/fixtures/golden/agy-ship-SKILL.md b/test/fixtures/golden/agy-ship-SKILL.md
index 7afe20234..6ccbd249d 100644
--- a/test/fixtures/golden/agy-ship-SKILL.md
+++ b/test/fixtures/golden/agy-ship-SKILL.md
@@ -576,7 +576,7 @@ repository-landing asks, including on Apple repos.
## Review Readiness Dashboard
-During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.
+In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.
```bash
~/.gemini/antigravity-cli/skills/gstack/bin/gstack-review-read
@@ -599,9 +599,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -610,8 +609,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -620,16 +618,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If `skip_eng_review` is true, show
+and its missing, stale or open-issue reason. With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted). If `skip_eng_review` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.
diff --git a/test/fixtures/golden/claude-ship-SKILL.md b/test/fixtures/golden/claude-ship-SKILL.md
index d997d2c1b..39ca8aa00 100644
--- a/test/fixtures/golden/claude-ship-SKILL.md
+++ b/test/fixtures/golden/claude-ship-SKILL.md
@@ -581,7 +581,7 @@ repository-landing asks, including on Apple repos.
## Review Readiness Dashboard
-During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.
+In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.
```bash
~/.claude/skills/gstack/bin/gstack-review-read
@@ -604,9 +604,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -615,8 +614,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -625,16 +623,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If `skip_eng_review` is true, show
+and its missing, stale or open-issue reason. With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted). If `skip_eng_review` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.
diff --git a/test/fixtures/golden/codex-ship-SKILL.md b/test/fixtures/golden/codex-ship-SKILL.md
index d097c5708..9b69f681c 100644
--- a/test/fixtures/golden/codex-ship-SKILL.md
+++ b/test/fixtures/golden/codex-ship-SKILL.md
@@ -596,7 +596,7 @@ repository-landing asks, including on Apple repos.
## Review Readiness Dashboard
-During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.
+In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.
```bash
[ -d "${GSTACK_ROOT:-/-}/bin" ]&&[ -d "$GSTACK_ROOT/lib" ]||{ _r=$(git rev-parse --show-toplevel 2>/dev/null)/.agents/skills/gstack;[ -d "$_r/bin" ]||_r=${CODEX_HOME:-~/.codex}/skills/gstack;[ -d "$_r/bin" ]||{ echo "gstack: no install found (tried $_r). Fix: ./setup --host codex from your gstack checkout; ./setup --status shows it.">&2;exit 1;};GSTACK_ROOT=$_r;}
@@ -620,9 +620,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -631,8 +630,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -641,16 +639,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If `skip_eng_review` is true, show
+and its missing, stale or open-issue reason. With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted). If `skip_eng_review` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.
diff --git a/test/fixtures/golden/factory-ship-SKILL.md b/test/fixtures/golden/factory-ship-SKILL.md
index 9adac6290..ec1c7ebef 100644
--- a/test/fixtures/golden/factory-ship-SKILL.md
+++ b/test/fixtures/golden/factory-ship-SKILL.md
@@ -577,7 +577,7 @@ repository-landing asks, including on Apple repos.
## Review Readiness Dashboard
-During pre-flight, read the existing review log and config to display readiness; the new pre-landing review runs in Step 9.
+In pre-flight, read the review log and config to show readiness; Step 9 runs the new pre-landing review.
```bash
[ -d "${GSTACK_ROOT:-/-}/bin" ]&&[ -d "$GSTACK_ROOT/lib" ]||{ _r=$(git rev-parse --show-toplevel 2>/dev/null)/.factory/skills/gstack;[ -d "$_r/bin" ]||_r=~/.factory/skills/gstack;[ -d "$_r/bin" ]||{ echo "gstack: no install found (tried $_r). Fix: ./setup --host factory from your gstack checkout; ./setup --status shows it.">&2;exit 1;};GSTACK_ROOT=$_r;}
@@ -601,9 +601,8 @@ Historical source "claude" is a native subagent; "claude-code" is the external C
Do not infer old providers or unknown models from today's harness. A native result
does not fill missing, disabled or skipped outside coverage.
-**Source attribution:** Append a recorded `via` to the suffix, for example
-"CLEAR (PLAN via /autoplan)" or "CLEAR (DIFF via /ship)". Without `via`, keep
-"CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
+**Source attribution:** Append a recorded `via` to the suffix ("CLEAR (PLAN via
+/autoplan)"); without one, keep "CLEAR (PLAN)" or "CLEAR (DIFF)". Below the dashboard, group `autoplan-voices`
and `design-outside-voices` by workflow run and phase. Show each phase's provider
and outside_status; retain partial coverage. These details do not clear Eng Review.
@@ -612,8 +611,7 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Content-first rule:** For `review`, `adversarial-review`, `codex-review`,
ship-stage reviews and `design-review-lite`, use `review_freshness.status`
and show its `reason`. CURRENT means a completed clean review whose start and
- end content fingerprints equal the current `---WTREE---` fingerprint. This
- fingerprint covers working-tree content, not just the commit.
+ end content fingerprints equal the current `---WTREE---` fingerprint.
STALE or UNVERIFIED cannot clear Eng Review. Missing `review_freshness`,
including legacy log-only records, means UNVERIFIED. Never fall back to HEAD
equality or commit distance for diff evidence, even at zero commits.
@@ -622,16 +620,15 @@ and outside_status; retain partial coverage. These details do not clear Eng Revi
- **Plan records** (plan-ceo-review, plan-eng-review, plan-design-review and
codex-plan-review) use the 7-day window, not the working-tree fingerprint.
If `plan_sha256` is present, you may compare the plan file and report a mismatch.
- For plan records only, compare the recorded commit with `---HEAD---`.
- If different, run `git rev-list --count STORED_COMMIT..HEAD` and report
+ Compare the recorded commit with `---HEAD---`; if different, run
+ `git rev-list --count STORED_COMMIT..HEAD` and report
"Note: {skill} review from {date} may be stale — {N} commits since review".
- A failed command means UNKNOWN, treated as stale. Without commit tracking,
- retain the note to consider re-running. Omit staleness notes when all reviews
- are current.
+ A failed command means UNKNOWN, treated as stale; without commit tracking,
+ suggest a re-run. Omit notes when all reviews are current.
**3. Choose the historical verdict.** CLEARED requires the selected Eng Review
to be `clean`, within 7 days and fresh under step 2. Otherwise report NOT CLEARED
-and its missing, stale or open-issue reason. If `skip_eng_review` is true, show
+and its missing, stale or open-issue reason. With no Eng Review record, say "no saved Eng Review: run the `PERSIST:` line a read-only /plan-eng-review printed, or rerun it" (docs/troubleshooting.md#plan-eng-review-not-persisted). If `skip_eng_review` is true, show
"SKIPPED (global)" for Eng Review and CLEARED for this dashboard.
This verdict never skips Step 9 or its finding, approval and convergence gates. Continue Step 1 even when history is NOT CLEARED.
diff --git a/test/fixtures/outside-review-severity/codex-3105/README.md b/test/fixtures/outside-review-severity/codex-3105/README.md
new file mode 100644
index 000000000..84bb45fc1
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/README.md
@@ -0,0 +1,9 @@
+# Codex reply shapes from #3105
+
+Issue #3105 reports 13 Codex consult/challenge replies that the outside-review
+helper summarised as `VERDICT: clean / FINDINGS: none`. The issue describes the
+forms but does not include the replies, so these files are synthesized from the
+forms it documents (`1. **P1 — x**`, `1. P2 — x`, a bare `P2 —` label, a final
+`Verdict: not ready (...)` line, and one `ready` reply with a single P3), plus
+negative controls: a real no-findings reply and P1 tokens quoted inside code.
+`test/outside-review-unparsed-severity.test.ts` holds the expected verdicts.
diff --git a/test/fixtures/outside-review-severity/codex-3105/bare-dash-p2.txt b/test/fixtures/outside-review-severity/codex-3105/bare-dash-p2.txt
new file mode 100644
index 000000000..c17e547a7
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/bare-dash-p2.txt
@@ -0,0 +1,6 @@
+Two advisory issues; nothing blocks.
+
+P2 — The new flag is missing from the help text.
+P2 — The changelog entry names the wrong command.
+
+Verdict: not ready (2 P2)
diff --git a/test/fixtures/outside-review-severity/codex-3105/blocking-plus-unparsed.txt b/test/fixtures/outside-review-severity/codex-3105/blocking-plus-unparsed.txt
new file mode 100644
index 000000000..49f9818bd
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/blocking-plus-unparsed.txt
@@ -0,0 +1,6 @@
+Diff review.
+
+- [P1] The lock is released before the write lands. `bin/gstack-brain-sync:763`
+- P2/P3 nits: naming and a stale comment.
+
+Verdict: not ready
diff --git a/test/fixtures/outside-review-severity/codex-3105/diff-numbered-dash.txt b/test/fixtures/outside-review-severity/codex-3105/diff-numbered-dash.txt
new file mode 100644
index 000000000..6a62f0964
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/diff-numbered-dash.txt
@@ -0,0 +1,7 @@
+I read the diff and ran the focused tests.
+
+1. P2 — The retry helper logs the attempt count twice. `lib/retry.ts:41`
+2. P1 — The cap is read before the config loads, so it is always 0. `lib/retry.ts:12`
+3. P3 — Rename `n` to `attempt`. `lib/retry.ts:18`
+
+Verdict: not ready (1 P1, 1 P2, 1 P3)
diff --git a/test/fixtures/outside-review-severity/codex-3105/grouped-unparsed.txt b/test/fixtures/outside-review-severity/codex-3105/grouped-unparsed.txt
new file mode 100644
index 000000000..4300a47d9
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/grouped-unparsed.txt
@@ -0,0 +1,8 @@
+Plan review.
+
+## P1/P2 findings
+
+- The guard trusts the payload without a flush check.
+- Rule-id confirmation cannot bind exact bytes.
+
+Verdict: revise
diff --git a/test/fixtures/outside-review-severity/codex-3105/no-findings.txt b/test/fixtures/outside-review-severity/codex-3105/no-findings.txt
new file mode 100644
index 000000000..4d1c3f303
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/no-findings.txt
@@ -0,0 +1,6 @@
+I read the diff, ran `bun test test/retry.test.ts`, and checked every caller of
+`retry()`. No findings: the cap is enforced and the tests cover the boundary.
+
+Recommendation: ship because the change is covered and correct.
+
+Verdict: ready
diff --git a/test/fixtures/outside-review-severity/codex-3105/not-ready-unlabeled.txt b/test/fixtures/outside-review-severity/codex-3105/not-ready-unlabeled.txt
new file mode 100644
index 000000000..014361af3
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/not-ready-unlabeled.txt
@@ -0,0 +1,4 @@
+The plan does not say how the queue drains on shutdown, and the retry path
+can double-send. Both need an answer before implementation.
+
+Verdict: not ready
diff --git a/test/fixtures/outside-review-severity/codex-3105/p1-in-code.txt b/test/fixtures/outside-review-severity/codex-3105/p1-in-code.txt
new file mode 100644
index 000000000..62f153852
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/p1-in-code.txt
@@ -0,0 +1,12 @@
+The classifier now reads tags like `[P1]` and lines such as `P1: x`, which is
+what Codex prints. Example input it handles:
+
+```
+[P1] The cap is ignored.
+P1: The cap is ignored.
+1. **P1 — The cap is ignored.**
+```
+
+No issues found in the changed parser.
+
+Recommendation: ship because the parser handles every documented form.
diff --git a/test/fixtures/outside-review-severity/codex-3105/plan-bold-dash.txt b/test/fixtures/outside-review-severity/codex-3105/plan-bold-dash.txt
new file mode 100644
index 000000000..b31d11b62
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/plan-bold-dash.txt
@@ -0,0 +1,11 @@
+Found six P1/P2 issues. The plan is close, but the scanner still has gaps.
+
+1. **P1 — Shell heredocs behind reserved words escape scanning.** `bin/gstack-redact-prepush:546`
+ A heredoc opened after `then` or `do` is never handed to the scanner.
+2. **P2 — Expanding heredocs lose the preceding failure context.** `bin/gstack-redact-prepush:562`
+3. **P1 — The allowlist matches by basename.** `bin/gstack-redact-prepush:310`
+4. **P2 — The fixture never exercises CRLF input.** `test/redact-prepush.test.ts:88`
+5. **P2 — The message omits the fix command.** `bin/gstack-redact-prepush:601`
+6. **P1 — A failed scan still exits 0 under `set +e`.** `bin/gstack-redact-prepush:640`
+
+Verdict: not ready (6 P1/P2)
diff --git a/test/fixtures/outside-review-severity/codex-3105/ready-one-p3.txt b/test/fixtures/outside-review-severity/codex-3105/ready-one-p3.txt
new file mode 100644
index 000000000..73f6e958c
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/ready-one-p3.txt
@@ -0,0 +1,5 @@
+The change is correct and the tests cover it.
+
+1. **P3 — The helper name is vague.** `lib/journal.ts:77`
+
+Verdict: ready (1 P3)
diff --git a/test/fixtures/outside-review-severity/codex-3105/table-p1.txt b/test/fixtures/outside-review-severity/codex-3105/table-p1.txt
new file mode 100644
index 000000000..a998e8a79
--- /dev/null
+++ b/test/fixtures/outside-review-severity/codex-3105/table-p1.txt
@@ -0,0 +1,4 @@
+| Severity | Finding | Where |
+|---|---|---|
+| P1 | The lock is released before the write lands | bin/gstack-brain-sync:763 |
+| P3 | A stale comment | bin/gstack-brain-sync:12 |
diff --git a/test/outside-review-unparsed-severity.test.ts b/test/outside-review-unparsed-severity.test.ts
new file mode 100644
index 000000000..bca28a2cc
--- /dev/null
+++ b/test/outside-review-unparsed-severity.test.ts
@@ -0,0 +1,114 @@
+/**
+ * #3105: every gate that summarises a review fails closed. Codex consult and
+ * challenge replies label findings `1. **P1 — x**`, `1. P2 — x` or `P2 —` and
+ * end `Verdict: not ready (...)`; the `execution` gate printed `VERDICT: clean /
+ * FINDINGS: none` for all of them. The fixtures in
+ * test/fixtures/outside-review-severity/codex-3105/ are synthesized from the
+ * forms the issue documents (it describes 13 replies but does not include them).
+ */
+import { describe, expect, test } from 'bun:test';
+import { spawnSync } from 'node:child_process';
+import * as fs from 'node:fs';
+import * as path from 'node:path';
+import { classifyOutsideReview, type OutsideGate } from '../lib/outside-review-result';
+import { GATE_OUTCOMES } from '../lib/gate-outcomes';
+
+const ROOT = path.resolve(import.meta.dir, '..');
+const LIB = path.join(ROOT, 'lib', 'outside-review-result.ts');
+const FIX = path.join(ROOT, 'test', 'fixtures', 'outside-review-severity', 'codex-3105');
+const fixture = (name: string) => path.join(FIX, name);
+const read = (name: string) => fs.readFileSync(fixture(name), 'utf8');
+const REC = 'Recommendation: fix it because the change loses data.';
+const cli = (gate: OutsideGate, name: string) =>
+ spawnSync(process.execPath, [LIB, '--verdict', '--label', 'Codex consult', gate, fixture(name)], { encoding: 'utf8', timeout: 10000 });
+
+describe('#3105 Codex reply shapes under the execution gate', () => {
+ for (const [name, status, stdout] of [
+ ['plan-bold-dash.txt', 3, 'VERDICT: findings\nFINDINGS: P1\n'],
+ ['diff-numbered-dash.txt', 3, 'VERDICT: findings\nFINDINGS: P1\n'],
+ ['bare-dash-p2.txt', 0, 'VERDICT: clean\nFINDINGS: P2\n'],
+ ['ready-one-p3.txt', 0, 'VERDICT: clean\nFINDINGS: P3\n'],
+ ['table-p1.txt', 3, 'VERDICT: findings\nFINDINGS: P1\n'],
+ ['not-ready-unlabeled.txt', 3, 'VERDICT: findings\nFINDINGS: unspecified\n'],
+ ['grouped-unparsed.txt', 4, 'VERDICT: unverified\nFINDINGS: none\nUNPARSED: line 3: "## P1/P2 findings"\nREASON: unparsed_severity\n'],
+ ['blocking-plus-unparsed.txt', 3, 'VERDICT: findings\nFINDINGS: P1\nUNPARSED: line 4: "- P2/P3 nits: naming and a stale comment."\n'],
+ ['no-findings.txt', 0, 'VERDICT: clean\nFINDINGS: none\n'],
+ ['p1-in-code.txt', 0, 'VERDICT: clean\nFINDINGS: none\n'],
+ ] as const) {
+ test(`${name}: exit ${status}`, () => {
+ const r = cli('execution', name);
+ expect([r.status, r.stdout]).toEqual([status, stdout]);
+ });
+ }
+
+ test('an unparsed label is unverified with its own reason, anchor and the quoted line', () => {
+ const r = cli('execution', 'grouped-unparsed.txt');
+ expect(r.stderr).toContain('Codex consult: ran, verdict unverified (');
+ expect(r.stderr).toContain('(line 3: "## P1/P2 findings")');
+ expect(r.stderr).toContain('bun lib/outside-review-result.ts --verdict <gate> <reply-file>');
+ expect(r.stderr).toContain('docs/troubleshooting.md#outside-review-unparsed-severity');
+ expect(GATE_OUTCOMES.unparsed_severity).toMatchObject({ state: 'ran', anchor: 'outside-review-unparsed-severity' });
+ });
+
+ test('parsed blocking findings win and still print the unparsed detail', () => {
+ const r = cli('execution', 'blocking-plus-unparsed.txt');
+ expect(r.stderr).toContain('Codex consult: findings block this review; separately,');
+ expect(r.stderr).toContain('line 4: "- P2/P3 nits: naming and a stale comment."');
+ expect(r.stderr).toContain('#outside-review-unparsed-severity');
+ });
+
+ test('a not-ready verdict with an unparsed label still blocks, never clean', () => {
+ const r = classifyOutsideReview({ text: '## P1 findings\nThe cap is ignored.\nVerdict: not ready', gate: 'execution' });
+ expect([r.verdict, r.findings.highest, r.unparsed]).toEqual(['findings', null, 'line 1: "## P1 findings"']);
+ });
+});
+
+describe('#3105 severity forms are read by every gate that summarises a review', () => {
+ const forms: Array<[string, string]> = [
+ ['**P1 — The cap is ignored.**', 'P1'],
+ ['1. **P1 — The cap is ignored.** `lib/retry.ts:12`', 'P1'],
+ ['**P1** — The cap is ignored.', 'P1'],
+ ['**P1:** The cap is ignored.', 'P1'],
+ ['1. P2 — The docs lag.', 'P2'],
+ ['P2 —', 'P2'],
+ ['P2 – The docs lag.', 'P2'],
+ ['- P0 - Secrets reach the log.', 'P0'],
+ ['### P1', 'P1'],
+ ['> 2) P3: rename the helper.', 'P3'],
+ ['| P1 | cap ignored |', 'P1'],
+ ['- `P1`: race in cleanup.', 'P1'],
+ ['High: the retry loop never stops.', 'P1'],
+ ['| 1 | high | cap ignored |', 'P1'],
+ ];
+ for (const gate of ['execution', 'structured', 'review'] as const) {
+ test(`${gate}: label forms`, () => {
+ for (const [text, highest] of forms) {
+ const r = classifyOutsideReview({ text: `${text}\n${REC}`, gate });
+ const verdict = highest === 'P0' || highest === 'P1' ? 'findings' : 'clean';
+ expect({ text, highest: r.findings.highest as string | null, verdict: r.verdict as string }).toEqual({ text, highest, verdict });
+ }
+ });
+ test(`${gate}: unparsed label positions fail closed with unparsed_severity`, () => {
+ for (const text of ['## P1 findings', '- **P1/P2** gaps remain.', '1. P1-ish: maybe a race.', 'P2, P3 and nits below.', '**[P1/P2]** cap ignored']) {
+ const r = classifyOutsideReview({ text: `${text}\n${REC}`, gate });
+ expect({ text, verdict: r.verdict as string, reason: r.reason as string | undefined }).toEqual({ text, verdict: 'unverified', reason: 'unparsed_severity' });
+ }
+ });
+ test(`${gate}: negative controls stay clean`, () => {
+ expect(classifyOutsideReview({ text: read('no-findings.txt'), gate }).verdict).toBe('clean');
+ expect(classifyOutsideReview({ text: read('p1-in-code.txt'), gate }).verdict).toBe('clean');
+ for (const text of ['The P1 queue drains first.', 'Ship it; we discussed P1 and P2 priorities yesterday.', 'See issue #P12.', 'Use a P10 bucket.'])
+ expect({ text, verdict: classifyOutsideReview({ text: `${text}\nNo issues found.\n${REC}`, gate }).verdict as string }).toEqual({ text, verdict: 'clean' });
+ });
+ }
+
+ test('an unlabeled consult reply with no severity markers stays clean', () => {
+ for (const text of ['Use a queue here; the writer pool blocks.', 'A high-level answer: use a queue.', 'Verdict: ready'])
+ expect({ text, verdict: classifyOutsideReview({ text, gate: 'execution' }).verdict as string }).toEqual({ text, verdict: 'clean' });
+ });
+
+ test('the proposal gate is not a review summary: no severity-word or unparsed checks', () => {
+ const proposal = '## P1 layout\nHigh: a dense table.\nRecommendation: table because operators compare many rows.';
+ expect(classifyOutsideReview({ text: proposal, gate: 'proposal' }).verdict).toBe('clean');
+ });
+});
diff --git a/test/plan-review-cases.test.ts b/test/plan-review-cases.test.ts
index f8c964272..738d62188 100644
--- a/test/plan-review-cases.test.ts
+++ b/test/plan-review-cases.test.ts
@@ -195,7 +195,7 @@ describe('plan report persistence precedes completion logging', () => {
expect(template.match(/\{\{PLAN_FILE_REVIEW_REPORT\}\}/g)).toHaveLength(1);
const logPolicy = compactProse(template.slice(log, dashboard));
if (skill === 'plan-eng-review') {
- expectAll(compactProse(template), [/at Review Log, use \*\*Blocked outcome\*\* instead of publishing a saved review/i,
+ expectAll(compactProse(template), [/at Review Log, use \*\*Report-back outcome\*\* instead of publishing a saved review/i,
/only a successful required log permits publication as a saved review/i]);
} else if (skill === 'plan-ceo-review') {
expectAll(logPolicy, [/successful write and Read-back/i, /failed plan\/report save or verification stops before this block/i,
@@ -561,14 +561,14 @@ describe('Eng approved-work decision gate', () => {
const routes = Object.fromEntries(policy.split('\n').filter(line => line.startsWith('| '))
.map(line => line.split('|').slice(1, -1).map(cell => cell.trim())).map(cells => [cells[0], cells[2]]));
expect(routes["Working plan, ledger and complete review report"]).toContain('wait without completion telemetry');
- expect(routes["Working plan, ledger and complete review report"]).toContain('then use **Blocked outcome**');
+ expect(routes["Working plan, ledger and complete review report"]).toContain('then **Report-back outcome**');
for (const auxiliary of ['QA Test Plan and task JSONL', 'TODOS.md']) {
expect(routes[auxiliary]).toContain('**not persisted**');
expect(routes[auxiliary]).toContain('continue');
}
expect(routes['Required Review Log']).toContain('The final gate cannot pass without this log');
expect(routes['Required Review Log']).toContain('Present its fields as **not persisted**');
- expect(routes['Required Review Log']).toContain('at Review Log, use **Blocked outcome** instead of publishing a saved review');
+ expect(routes['Required Review Log']).toContain('at Review Log, use **Report-back outcome** instead of publishing a saved review');
const log = template.split('## Review Log')[1]!.split('{{REVIEW_DASHBOARD}}')[0]!;
expect(log).toMatch(/finish step 3, after successful Read-back/i);
expect(log).not.toContain('PLAN MODE EXCEPTION — ALWAYS RUN');
@@ -582,10 +582,11 @@ describe('Eng approved-work decision gate', () => {
expectAll(compactProse(closing), [/display the Review Readiness Dashboard, then present the saved Completion summary/i,
/read-only EXIT PLAN MODE GATE in every host mode/i, /ExitPlanMode only in host plan mode/i,
/\*\*Recovery routing → Late change or missing work\*\* before navigation resumes/i,
- /only after both pass, run success telemetry/i, /requires \*\*Blocked outcome\*\*, not logging/i]);
+ /only after both pass, run success telemetry/i, /an unrecovered save requires \*\*Blocked outcome\*\*, not logging/i,
+ /forbidden persistence uses \*\*Report-back outcome\*\*/i]);
const publication = compactProse(closing.slice(closing.indexOf('3. **Log the saved review.**'), closing.indexOf('5. **Choose navigation.**')));
- expectAll(publication, [/if the required log is forbidden, show fields as not persisted and take \*\*Blocked outcome\*\*/i,
- /neither supplies completion or saved-dashboard credit/i]);
+ expectAll(publication, [/if the required log is forbidden, show fields as not persisted and take \*\*Report-back outcome\*\*/i,
+ /failures use the write policy's recovery/i]);
ordered(template, ['### TODOS.md updates', '{{PLAN_REVIEW_APPROVAL_CHECK}}', '## Required outputs',
'{{PLAN_FILE_REVIEW_REPORT}}', '## Review Log', '{{REVIEW_DASHBOARD}}', '## Next Steps — Review Chaining',
'## Learning hooks', '{{BRAIN_WRITE_BACK}}']);