/ship can finish when its docs audit fixes a reviewed doc after the last review round (GST-3532) (#4708)

/ship no longer gets stuck when its last-step docs audit corrects a line
in a doc the review read, after the PR's last allowed review round.

Why: gbrain#10059 had to skip its /ship record to land, because the only
fix /ship offered was a third review round, which the two-round limit
forbids.

Nothing to do: the next /ship run asks for one small read of the audit's
change on its own.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=testing
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 reader=red-team
Review-Finding: p2/outside-voice#1 reader=outside-voice
Review-Finding: p2/adversarial-native#1 reader=adversarial-native
Review-Finding: p2/adversarial-native#2 reader=adversarial-native
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 15:25:28 +00:00
1 parent a88cc7c1be
commit 4ae9ec7b00
18 files changed
+274 -21

No files matched your search

+1
View File
@@ -348,6 +348,7 @@ gstack_result_anchor() {
SHIP_RUN_RECORD_UNREADABLE) printf '%s' 'ship-run-record-unreadable' ;;
GRANT_UNKNOWN) printf '%s' 'grant-unknown' ;;
RECEIPT_CARRY_SCOPED_REVIEW) printf '%s' 'receipt-carry-scoped-review' ;;
RECEIPT_DOCS_AUDIT_READ) printf '%s' 'receipt-docs-audit-read' ;;
DOCS_AUDIT_BLOCKED) printf '%s' 'docs-audit-blocked' ;;
DOCS_RESULT_INVALID) printf '%s' 'docs-result-invalid' ;;
RECEIPT_PROSE_MISMATCH) printf '%s' 'receipt-prose-mismatch' ;;
+13 -1
View File
@@ -161,6 +161,9 @@ write flags: --pr --head --base --version --gated-tree --predecessor --gate <jso
with the content HEAD holds, each excluded or kept only because code names it (GST-1429); prints REVIEW_EXCLUDE_DOCS_AUDIT: and
records HEAD's selection. Any other change, or an unreadable snapshot, refuses as above. --docs-pre <Prepare snapshot> (the same
audit's first snapshot) narrows the audit's files to those whose content it changed, so uncommitted docs the review read stay.
An audit file the review kept for its own content (gate path, gate tags, agent prose, a secret line) refuses with
RECEIPT_DOCS_AUDIT_READ and writes a packet of the audit's change for one scoped reader, not a review round (GST-3532);
--docs-audit-read <record.json> (its clean { head, paths, reviewer, verdict, packet_sha256 }) binds it as docs_audit_read.
When a run audits twice, the last audit's post snapshot carries the earlier audit (gstack-docs-candidate snapshot --run --pre
--carry): files the earlier audit edited reset too, to their content before it, when HEAD holds what it left; a carried audit of
another run refuses (GST-1616).
@@ -349,7 +352,15 @@ async function cmdWrite(rest: string[], json: boolean): Promise<number> {
if (review.exclude.state === 'refused') { for (const l of review.exclude.lines) process.stderr.write(`${l}; nothing written\n`); return EXIT.refused; }
const excludeNow = review.exclude.state === 'active' ? review.exclude.record : null;
const excludeGiven = flag(rest, '--review-exclude') ?? 'none';
const excludeBound = writeExcludeBinds(repoRoot, base, headSha ?? head, review, flag(rest, '--review-exclude'), flag(rest, '--docs-post'), flag(rest, '--docs-pre'));
const excludeBound = writeExcludeBinds(repoRoot, base, headSha ?? head, review, flag(rest, '--review-exclude'), flag(rest, '--docs-post'), flag(rest, '--docs-pre'), flag(rest, '--docs-audit-read'));
if (!excludeBound.ok && excludeBound.packet) {
const at = headSha ?? head;
const packet = path.resolve(repoRoot, git(['rev-parse', '--git-path', `gstack/docs-audit-read-${at.slice(0, 12)}.md`], repoRoot) ?? `.git/gstack/docs-audit-read-${at.slice(0, 12)}.md`);
try { fs.mkdirSync(path.dirname(packet), { recursive: true }); fs.writeFileSync(packet, excludeBound.packet.text); }
catch (e) { process.stderr.write(`gstack-ship-receipt write: ${excludeBound.why}, but the reader's packet ${packet} cannot be written (${(e as Error).message.split('\n')[0]}); make its directory writable, then rerun write; nothing written\n`); return EXIT.fail; }
process.stderr.write(resultLine('gstack-ship-receipt write', 'RECEIPT_DOCS_AUDIT_READ', `${excludeBound.why}: one scoped reader (not a review round) reads ${packet}, then rerun write with --docs-audit-read <record.json> written outside the worktree ({"head":"${at}","paths":${JSON.stringify(excludeBound.packet.paths)},"reviewer":"<model>","verdict":"clean","packet_sha256":"${excludeBound.packet.sha256}"}); a finding goes to the lane's Captain; nothing written`) + '\n');
return EXIT.fail;
}
if (!excludeBound.ok) {
process.stderr.write(`gstack-ship-receipt write: field=review_exclude expected=${excludeNow?.digest ?? 'none'} recorded=${excludeGiven} source=${excludeNow?.source ?? `origin/${base} (no review_exclude_paths)`}: the --review-exclude argument names another selection than ${base}'s review_exclude_paths gives ${head.slice(0, 12)} (write compares the argument, not the review ledger)${flag(rest, '--review-exclude') === undefined ? '; no --review-exclude was given, so write compared none' : ''}${excludeBound.why ? `; the docs-audit exception does not apply: ${excludeBound.why}` : ''}; fix: when only Step 14.5's docs audit changed files under review_exclude_paths after the review, pass its --docs-post <audit-id>-post.json and --docs-pre <its Prepare snapshot>; otherwise rerun /ship's review on ${head.slice(0, 12)} (gstack-review-dispatch pass --base ${base}), run gstack-review-dispatch verify --ledger <ledger> and write with the --review-exclude <d> its REVIEW_EXCLUDE_RECORD: line prints (none when it prints no such line); nothing written (RECEIPT_INVALID)\n`);
return EXIT.fail;
@@ -410,6 +421,7 @@ async function cmdWrite(rest: string[], json: boolean): Promise<number> {
base_red: pause ? receiptBaseRed(pause) : undefined,
review_exclude: receiptExclude(review.exclude),
review_exclude_fallback: receiptExcludeFallback(review.exclude),
docs_audit_read: excludeBound.read,
no_stop: noStopArg(flag(rest, '--no-stop')),
};
} catch (e: any) { process.stderr.write(`gstack-ship-receipt write: ${e.message}\n`); return EXIT.usage; }