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
Ship's review records close five gaps, and --for gstack-ship installs the ship skill (GST-4093) (#4867)
Garry Tan36a8ae067ca3
diff --git a/bin/gstack-capy-install b/bin/gstack-capy-installindex 1be438995..cb16359de 100755--- a/bin/gstack-capy-install+++ b/bin/gstack-capy-install@@ -65,7 +65,7 @@ usage() { sed -n '2,32p' "$0" | sed 's/^# \{0,1\}//'; }need() { [ -n "${2:-}" ] || { echo "gstack-capy-install: $1 needs a value" >&2; usage >&2; exit 2; }; }while [ $# -gt 0 ]; docase "$1" in- --for|--only) need "$1" "${2:-}"; FOR="$2"; shift ;;+ --for|--only) need "$1" "${2:-}"; FOR="$2"; [ "$FOR" = gstack-ship ] && FOR=ship; shift ;;--require) need "$1" "${2:-}"; REQUIRE="$2"; shift ;;--with-browser) WITH_BROWSER=1 ;;--revision) need "$1" "${2:-}"; REVISION="$2"; shift ;;diff --git a/bin/gstack-review-dispatch b/bin/gstack-review-dispatchindex 93511295d..4b96e12be 100755--- a/bin/gstack-review-dispatch+++ b/bin/gstack-review-dispatch@@ -529,7 +529,8 @@ function passStep(cmd: string): number {if (checked.reason !== 'cyber_policy_refused') { process.stdout.write(`RETRY: none reader=${r.reader} (not a cyber_policy refusal; recorded as unavailable coverage as before)\n`); return EXIT.ok; }let voices: { laneModel?: string | null; readers?: Record<string, { model_id?: string } | null> } = {};try { voices = JSON.parse(fs.readFileSync(path.join(m.out, 'voice-models.json'), 'utf8')); } catch { voices = {}; }- const taken = [voices.laneModel, voices.readers?.['adversarial-native']?.model_id].filter((id): id is string => typeof id === 'string' && id.includes('/')).map(id => id.split('/')[0]!.toLowerCase());+ const native = Object.entries(voices.readers ?? {}).filter(([key]) => key.split('#')[0] === 'adversarial-native').map(([, v]) => v?.model_id);+ const taken = [voices.laneModel, ...native].filter((id): id is string => typeof id === 'string' && id.includes('/')).map(id => id.split('/')[0]!.toLowerCase());const next = planCyberRetry(m, r, taken);writeManifest(file, m);process.stdout.write(`${gateOutcomeLine(`Outside voice ${r.reader}`, 'cyber_policy_refused', checked.detail)}\n${next@@ -597,7 +598,8 @@ function program(): number {/*** The receipt's review_targeted record from the newest targeted dispatch: done only when its brief was sent verbatim, its output- * collected, and it was rendered on a committed diff (uncommitted never proves what was read). `head` names the commit it read:+ * collected, and it was rendered on a committed diff (uncommitted never proves what was read); verify also fails a sliced record+ * whose SLICE row is not MATCH, since a dirty slice set never proves every file was read. `head` names the commit it read:* a later commit does not undo the read, and gstack-ship-receipt write binds the record only while that commit's product patch is* the receipt's (GST-986: Step 11 fixes after the read printed status=failed findings=0 for a completed reader).* R65's merged reader (an adversarial-native brief rendered with --classes) is a targeted dispatch too (design C7).@@ -720,7 +722,9 @@ function main(): number {for (const r of v.rows) process.stdout.write(`${r.kind} ${r.reader} ${r.status} ${r.detail}\n`);for (const r of v.rows.filter(x => x.kind === 'FETCH' && x.status === 'VIOLATION')) process.stdout.write(`FETCH_VIOLATION: ${r.reader} ${r.detail} (a reader of that stage fetched; its replies are quarantined and the pass cannot certify until the stage reruns clean; docs/troubleshooting.md#fetch-violation)\n`);if (!v.briefs) { process.stdout.write('VERIFY: no brief records (this run\'s ledger kept no prompts; dispatched-vs-rendered cannot be checked)\n'); return EXIT.refused; }- const record = targetedRecord(ledger, v.rows);+ const slices = verifySlices(readLedger(ledger), v.rows);+ const found = targetedRecord(ledger, v.rows);+ const record = found && slices.some(r => r.reader === found.raised_by && r.status !== 'MATCH') ? { ...found, status: 'failed' as const } : found;if (record) {process.stdout.write(`TARGETED_RECORD: classes=${record.classes.join(',')} status=${record.status} findings=${record.findings} brief=${record.brief_sha.slice(0, 12)} rules=${record.rules} read=${record.head?.slice(0, 12) ?? 'none'}\n`);if (flag('--targeted-out')) fs.writeFileSync(flag('--targeted-out')!, JSON.stringify(record) + '\n');@@ -728,7 +732,6 @@ function main(): number {const sel = excludeRecord(ledger);if (sel && 'digest' in sel) process.stdout.write(`REVIEW_EXCLUDE_RECORD: digest=${sel.digest} (gstack-ship-receipt write --review-exclude ${sel.digest})\n`);if (sel && 'mixed' in sel) process.stdout.write(`REVIEW_EXCLUDE_RECORD: mixed digests=${sel.mixed.join(',')} (readers read different review_exclude_paths selections; rerun the review so every reader reads HEAD's)\n`);- const slices = verifySlices(readLedger(ledger), v.rows);for (const r of slices) process.stdout.write(`${r.kind} ${r.reader} ${r.status} ${r.detail}\n`);const clean = v.clean && !(sel && 'mixed' in sel) && slices.every(r => r.status === 'MATCH');if (v.verdicts.asked) process.stdout.write(`VERIFY_VERDICT: agree=${v.verdicts.agree} asked=${v.verdicts.asked} (informational: a disagreeing count already counts its blockers; docs/review-policy.md#verdict-line)\n`);diff --git a/capy/skill/gstack/SKILL.md b/capy/skill/gstack/SKILL.mdindex 30729d357..14c7137ac 100644--- a/capy/skill/gstack/SKILL.md+++ b/capy/skill/gstack/SKILL.md@@ -7,7 +7,7 @@ description: Install and use gstack in Capy and Claude Code. Load at session sta## Session start: check, then install only when needed-**Crew lanes:** after this check passes, read [lane-card.md](lane-card.md), not the rest of this file; it says what to read before /ship. Resolve `scripts/install.sh` relative to this SKILL.md, not the working repository. It is a frozen bootstrapper: it prints `gstack-capy-skill: wrapper <n> (<path>)` first, learns the supported minimum from gstack's remote, and hands over to the checkout's own wrapper (`bin/gstack-capy-session`).+**Crew lanes:** after this check passes, read [lane-card.md](lane-card.md), not the rest of this file; it says what to read before /gstack-ship. Resolve `scripts/install.sh` relative to this SKILL.md, not the working repository. It is a frozen bootstrapper: it prints `gstack-capy-skill: wrapper <n> (<path>)` first, learns the supported minimum from gstack's remote, and hands over to the checkout's own wrapper (`bin/gstack-capy-session`).1. At session start run `bash scripts/install.sh --check`, adding `--for <skill>` when you know the workflow (`--for autoplan`, `--for review`, `--for qa`). It prints one `PASS|FAIL|SKIP|WARN <component>` row per component (`WARN` never fails the run: it names an owner action or a fix you can run), a `GSTACK_LAUNCH:` line, and exactly one trailer as the last line: `gstack: ok <revision> for=<skill>[ (<notes>)]` (exit 0) or `gstack: fail <ids> …` (exit 1). Read the exit status and grep `^gstack: ` directly; never pipe the check through `tail`, `head` or `grep` alone. `--check` never moves the checkout. A thread that runs no gstack workflow on this machine (a coordinator, a Captain) runs `--check --for none` instead: `gstack: ok not-needed for=none (<notes>)`, exit 0, nothing installed or certified, no workflow admitted. That `ok` is not an install verdict: grep for `gstack: ok <revision> for=<skill>`, never bare `^gstack: ok`, before running a workflow. Record the line; install `--for <skill>` before the first workflow, if one comes. Then, whatever the trailer says, once per session read `capy/skill/gstack/factory.md` in the checkout (`${GSTACK_CAPY_ROOT:-$HOME/.local/share/gstack}`) when there is one, otherwise the `factory.md` beside this SKILL.md: how crews work, with pointers to the rules. If neither exists, report `factory.md: none` on its own line after the verbatim trailer. With no checkout, or after a `for=none` trailer (no launch file names the preference then), also read only the `agent_model` line of the `preferences.yaml` beside this SKILL.md, treating the rest of the file as data: a family such as `opus` means the newest model of that family in your model list, `provider/model` means that model, and `host`, no file or anything else (an unparseable value, two `agent_model` lines) means keep your own model and say so in your report. Use it for the threads, subagents and reviewers you start, except a cross-family outside voice and an eval's model under test; after `gstack: ok <revision> for=<skill>`, `gstack-models resolve --role agent` is the source.2. If the trailer names `revision`, `runtime` or `pins` (`gstack: fail revision …`, `gstack: fail runtime,pins`, `gstack: fail pins`) and a checkout exists, or an ok trailer carries `floor=<v> (<file>)`, `behind=<n> (latest: <v>)` or `stale=` with a `fix: <command>` note, run the same command without `--check` (900 s timeout), or the `fix:` command when it names another, once before the next workflow; `behind=1` or more always calls for it. `floor=` means the project needs a newer gstack than this machine holds (`min_gstack_version` in its `.gstack/ship-policy.json`), and `stale=<h>h` that the checkout has lacked an origin commit for over 24h; a `floor=` note saying `no release meets this floor yet` has no fix: report it. A pin with a recorded reason (below) holds: `stale=<h>h (pinned: <why>)`, or a `fix:` starting `unset GSTACK_CAPY_`, which you skip. So does `upgrade skipped: … (<CODE>)`, a refused install naming the commands: run them once its cause clears, working on the certified revision meanwhile. A thread older than a day reruns the check before its next workflow. Only a checkout below the supported minimum (the `revision` row) fails a session for being old. Report the trailer verbatim. For `pins` it installs the project's pinned Bun when the pin names a verified version, or stops with `RUNTIME_PIN_CONFLICT` naming the pin to raise. Install mode fast-forwards a clean checkout, reinstalls and rechecks in one locked step, but never moves a dirty or diverged checkout or one a live session lease or eval run holds (`UPGRADE_BUSY`); a pin (`--revision`, detached, another branch, `GSTACK_CAPY_SELF_UPGRADE=off`, `GSTACK_CAPY_AUTO_UPGRADE=0`) holds past 24 hours only with a recorded reason (`GSTACK_PIN_REASON=<why>` or `git -C <checkout> config gstack.pinReason <why>`), else the install overrides it (`PIN_UNREASONED`). Details: `docs/capy-install.md` in the checkout.@@ -38,15 +38,15 @@ If no specific skill was requested, use the router's task-to-skill mapping. ReadFor `/autoplan` driven from Capy, read `autoplan/DRIVER.md` in the checkout (`~/.local/share/gstack/autoplan/DRIVER.md`): the compact phase loop, artifact contract and gate protocol, without the interactive preamble. A checkout without that file predates it; follow its `autoplan/SKILL.md` instead. Run every command with the `GSTACK_LAUNCH` assignments and read outputs as files, not prose: the run directory holds `run.json`, `decisions.jsonl`, `findings.jsonl`, `tasks.jsonl`, `timing.json`, `plan.md` and `review-record.md`, and the run ends with `GSTACK_RESULT: skill=autoplan status=gate_pending run=<dir>`. `~/.local/share/gstack/bin/gstack-artifact validate <dir>/run.json` is the completion check. The gate is answered through `gstack-autoplan answer` (or `gstack-gate parse`) with the printed `gate_rev`; an unattended run never approves its own gate. `docs/unattended.md` in the checkout is the contract.-For `/ship` driven from Capy, read `ship/DRIVER.md` in the checkout (`~/.local/share/gstack/ship/DRIVER.md`): one or two calls per phase, and the section each STOP needs. The thread that owns the pull request runs /ship itself and starts its reviewers as its own subagents; never start a subagent to run /ship. A checkout without that file predates it; follow its `ship/SKILL.md` instead.+For `/gstack-ship` driven from Capy, read `ship/DRIVER.md` in the checkout (`~/.local/share/gstack/ship/DRIVER.md`): one or two calls per phase, and the section each STOP needs. The thread that owns the pull request runs /gstack-ship itself and starts its reviewers as its own subagents; never start a subagent to run /gstack-ship. A checkout without that file predates it; follow its `ship/SKILL.md` instead.Run directories and scratch on Capy live under `~/.capy/work/<name>` (`--out ~/.capy/work/<project>/autoplan`), never `/tmp`: Capy wipes `/tmp` when a machine sleeps, and a vanished run cannot be resumed, answered or exported. Likewise any file a later turn reads.Capy checklist for `/autoplan`: drive `gstack-autoplan`, never a hand adaptation presented as a run. Relay `gstack-gate render <dir>/gate.json --all` with `rec` (every recommendation, plan changes included) as the one-word default; answer with `--by agent:<id> --owner-reply "<their words>"`. Set `GSTACK_AUTOPLAN_CHECKPOINT_DIR` to a private project-user Drive folder; after machine replacement, `gstack-autoplan resume --out <new dir> --from <that dir>` restores the newest valid checkpoint.-Token caps on /ship: pass a brief's cap as `--token-cap <n>`. /ship reads `cost.tokens` and `cost.credits` from `tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /ship, its reviewers included) inside the same execute program as the `gstack-ship-budget` command that takes them as `--reading <n> --credits <c>`, never alone. `ship/DRIVER.md` starts `--mode observe`: each program ends with `note`, and only a note past the cap stops (`docs/ship-budget.md`).+Token caps on /gstack-ship: pass a brief's cap as `--token-cap <n>`. /gstack-ship reads `cost.tokens` and `cost.credits` from `tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /gstack-ship, its reviewers included) inside the same execute program as the `gstack-ship-budget` command that takes them as `--reading <n> --credits <c>`, never alone. `ship/DRIVER.md` starts `--mode observe`: each program ends with `note`, and only a note past the cap stops (`docs/ship-budget.md`).-/ship on Capy is about a dozen calls, each an execute program (`ship/DRIVER.md`). Each review pass and Step 11 is one call to the checked-in pass program (fill only `input`): `const t0 = await now(); const p = (await tools.capy.bash({ command: ". '<launch file>' && gstack-review-dispatch program", description: "Pass" })).output.split("\n"); return p[0] + "\n" + (await new (Object.getPrototypeOf(async () => {}).constructor)("tools", "sleep", "now", "input", JSON.parse(p[1]))(tools, sleep, now, { startedAt: t0, launch: "<launch file>", cwd: "<repo>", base: "<base>", out: "<run dir>/p<n>", pass: "<run>-p<n>", laneModel: "<your model id>", planFlags: [], logStart: ["review"], jam: "<jam id>", record: "<rec>", step: "9.2" }));` It plans, logs `logStart` (`reservation` mode from `RESERVATION_ID:`), sends each brief on `machine: "shared"`, then polls: one `tools.subagent.list` per ~20 s tick, returning 200 s after the program's first line, where a reader is settled only at status `done` or `failed` or with a `summary` (a just-created `idle` reader has not run); it starts readers under `rejected` with `tools.subagent.start` as slots free and stops on one stuck 20 minutes. It ends on `NEXT:` (`poll`: rerun) or `STOP:`. `models` maps roles to models (`outside-voice`: another family, pinned in `voice-models.json`); Step 11 swaps `logStart` for `stage: "voices"`; a full repeat pass, `diffBase: "<RANGE_BASE>"` (none on the read-only final review, which prints `READ_ONLY:`). Step 14.5 (`step: "14.5"`) and, with a bound plan, Step 8 use `extras`, JSON `{name, prompt_file, first, model}` (prompts verbatim from their sections); they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`. Every other phase is one call to `gstack-ship-phase program`, loaded the same way, with `input` `{ startedAt, launch, cwd, dir: "<run dir>", phase: <n>, commands: ["<bin> …"], record, jam, step: "<last step>" }` (Phase 2's `gstack-ship-budget start` takes `--reading "$GSTACK_SHIP_READING" --credits "$GSTACK_SHIP_CREDITS"`; `pass: { … }` runs that pass after the commands); on `NEXT: rerun`, call it again unchanged. Waits under about 80 minutes: never let 5 minutes pass between calls. While readers run, never end the turn on `wait`; rerun the loader. Else re-issue `wait` with `duration_seconds: 200` and operation ids. A wait expected past 80 minutes (full CI) ends the turn on one `wait` on its operations; never poll every 10-15 minutes. `STOP: past 100 minutes`: report its `stop.json` and end. At Step 22 report the `CALLS:` line of `gstack-ship-budget calls --record <rec>`. A small waiting child saves nothing. Never hand-run a reader. Every pass and Step 11 voice runs through that pass program, and each logs its row through Step 9.4's persistence (`gstack-review-log --start`/`--finish`); without the row `gstack-review-read` prints `NO_REVIEWS`, so no stop or finish can bind the reading. A scoped reader after the review bound (one a receipt or carry refusal asks for) is planned with `gstack-review-plan --post-review`, and run as it prints. /ship plans no fix-check: a code change after round 1 gets a full round 2; after round 2 the PR ships with its open notes or its Captain rules, and a PR past the cap whose code changed gets one read-only full review. Fix-check and round grants are deprecated and go in the next release: ask for none.+/gstack-ship on Capy is about a dozen calls, each an execute program (`ship/DRIVER.md`). Each review pass and Step 11 is one call to the checked-in pass program (fill only `input`): `const t0 = await now(); const p = (await tools.capy.bash({ command: ". '<launch file>' && gstack-review-dispatch program", description: "Pass" })).output.split("\n"); return p[0] + "\n" + (await new (Object.getPrototypeOf(async () => {}).constructor)("tools", "sleep", "now", "input", JSON.parse(p[1]))(tools, sleep, now, { startedAt: t0, launch: "<launch file>", cwd: "<repo>", base: "<base>", out: "<run dir>/p<n>", pass: "<run>-p<n>", laneModel: "<your model id>", planFlags: [], logStart: ["review"], jam: "<jam id>", record: "<rec>", step: "9.2" }));` It plans, logs `logStart` (`reservation` mode from `RESERVATION_ID:`), sends each brief on `machine: "shared"`, then polls: one `tools.subagent.list` per ~20 s tick, returning 200 s after the program's first line, where a reader is settled only at status `done` or `failed` or with a `summary` (a just-created `idle` reader has not run); it starts readers under `rejected` with `tools.subagent.start` as slots free and stops on one stuck 20 minutes. It ends on `NEXT:` (`poll`: rerun) or `STOP:`. `models` maps roles to models (`outside-voice`: another family, pinned in `voice-models.json`); Step 11 swaps `logStart` for `stage: "voices"`; a full repeat pass, `diffBase: "<RANGE_BASE>"` (none on the read-only final review, which prints `READ_ONLY:`). Step 14.5 (`step: "14.5"`) and, with a bound plan, Step 8 use `extras`, JSON `{name, prompt_file, first, model}` (prompts verbatim from their sections); they cannot block, so omit `model`: the pass prints `AUDIT_MODEL:`. Every other phase is one call to `gstack-ship-phase program`, loaded the same way, with `input` `{ startedAt, launch, cwd, dir: "<run dir>", phase: <n>, commands: ["<bin> …"], record, jam, step: "<last step>" }` (Phase 2's `gstack-ship-budget start` takes `--reading "$GSTACK_SHIP_READING" --credits "$GSTACK_SHIP_CREDITS"`; `pass: { … }` runs that pass after the commands); on `NEXT: rerun`, call it again unchanged. Waits under about 80 minutes: never let 5 minutes pass between calls. While readers run, never end the turn on `wait`; rerun the loader. Else re-issue `wait` with `duration_seconds: 200` and operation ids. A wait expected past 80 minutes (full CI) ends the turn on one `wait` on its operations; never poll every 10-15 minutes. `STOP: past 100 minutes`: report its `stop.json` and end. At Step 22 report the `CALLS:` line of `gstack-ship-budget calls --record <rec>`. A small waiting child saves nothing. Never hand-run a reader. Every pass and Step 11 voice runs through that pass program, and each logs its row through Step 9.4's persistence (`gstack-review-log --start`/`--finish`); without the row `gstack-review-read` prints `NO_REVIEWS`, so no stop or finish can bind the reading. A scoped reader after the review bound (one a receipt or carry refusal asks for) is planned with `gstack-review-plan --post-review`, and run as it prints. /gstack-ship plans no fix-check: a code change after round 1 gets a full round 2; after round 2 the PR ships with its open notes or its Captain rules, and a PR past the cap whose code changed gets one read-only full review. Fix-check and round grants are deprecated and go in the next release: ask for none.## Plan, approve, ship@@ -54,8 +54,8 @@ Every Capy thread using gstack follows these for new work, Captain or not. The r- **Plan first.** Run `/autoplan` on new functionality right after the install check. The lean run (the Capy default) is one reviewer over plan and draft code; `--full` adds every phase.- **ELI5, then the word.** Send the plan and gate to the person, or the Captain, in plain language: `gstack-owner-brief render --captain --out <run dir> --captain-name "<Captain name>"`, its choices as lettered lines in the ask format (`crew/docs/captain.md`) and "do it" taking every recommendation at full scope. Build only after their word is answered into the run and it reports `APPROVED`; then `gstack-approvals import --autoplan <run dir> --by "<owner>"`.-- **/ship before ready.** Run /ship at the final pushed head before a PR is called ready; `SHIP_RECEIPT: pr=<n> head=<head>` must name that head, and a later push needs a new /ship. The review inside /ship, like the autoplan, is sized to the change.-- **Run /ship yourself, then keep the PR.** The thread that owns the PR runs /ship phase by phase (`ship/DRIVER.md`), with its reviewers as its own subagents. Once /ship prints its receipt, the thread reads the PR's checks and comments once, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /ship sequence).+- **/gstack-ship before ready.** Run /gstack-ship at the final pushed head before a PR is called ready; `SHIP_RECEIPT: pr=<n> head=<head>` must name that head, and a later push needs a new /gstack-ship. The review inside /gstack-ship, like the autoplan, is sized to the change.+- **Run /gstack-ship yourself, then keep the PR.** The thread that owns the PR runs /gstack-ship phase by phase (`ship/DRIVER.md`), with its reviewers as its own subagents. Once /gstack-ship prints its receipt, the thread reads the PR's checks and comments once, runs `gstack-ship-queue ready` and owns the PR thereafter: slot stamp, re-READY, receipt carry (`crew/docs/captain.md`, the lane's /gstack-ship sequence).- **No merge without the owner's word.** A thread never merges on its own; under a Captain the controller merges on a recorded standing approval, and a thread with no Captain asks the person.Exempt from the plan step: read-only work, the daily flaky pass's repairs, slot stamps, CHANGELOG-only resolves, cap re-pins under a written grant, S1 emergencies (a broken install or upgrade, a red main, a security bug) and fixes from an already-diagnosed, audited problem list. Other bug fixes skip plan review (`--kind fix`, R65) but carry a repro on current main or a failing test written first; features get the lean run (`--kind feature`).@@ -69,7 +69,7 @@ When you work for a Capy Captain (a crew thread) or straight for a person, gstac- **These always need a fresh ask:** a product or behaviour decision, spend over a stated cap, anything published outside the repository, a change to a threshold, budget or trial count, closing someone's contribution without landing it, and anything destructive.- **Record every answer.** Use `gstack-approvals add --ask … --words "<their exact words>" --by … --scope …`, or after an autoplan answer, `gstack-approvals import --autoplan <run dir> --by <name>`. `gstack-approvals render` prints the `## Approvals` table for your report and the PR body. Rows are secret-scanned, and on Capy they are mirrored to the private Drive folder.- **Plan approvals** use `gstack-owner-brief render --captain --out <run dir>`. It prints before → after, why it matters, what caused this work, the big decisions (options, the pick, why, what would flip it) and what we need, as lettered ask lines closed by "do it". Relay it whole. Gate codes appear only on its last line, which is for you. If it exits `CAPTAIN_BRIEF_INCOMPLETE`, add the missing plan sections first.-- **Merge asks.** /ship's PR body opens with plain sentences, then `## What changed` (captioned before/after images from `gstack-pr-shots` or a UI screenshot, uploaded with Capy's PR asset tool), `## Why` and `## Blast radius`, Agent notes last (`## Approvals`). Your READY report attaches the key image.+- **Merge asks.** /gstack-ship's PR body opens with plain sentences, then `## What changed` (captioned before/after images from `gstack-pr-shots` or a UI screenshot, uploaded with Capy's PR asset tool), `## Why` and `## Blast radius`, Agent notes last (`## Approvals`). Your READY report attaches the key image.## Before any push or pull requestdiff --git a/capy/skill/gstack/scripts/install.sh b/capy/skill/gstack/scripts/install.shindex 2d951bdb0..f4791d8f9 100755--- a/capy/skill/gstack/scripts/install.sh+++ b/capy/skill/gstack/scripts/install.sh@@ -53,7 +53,7 @@ args=()while [ $# -gt 0 ]; docase "$1" in--check) check=1 ;;- --for|--only) skill="${2:-}"; args+=("$1" "${2:-}"); shift ;;+ --for|--only) skill="${2:-}"; [ "$skill" = gstack-ship ] && skill=ship; args+=("$1" "$skill"); shift ;;--revision) revision="${2:-}"; args+=("$1" "${2:-}"); shift ;;*) args+=("$1") ;;esacdiff --git a/changelog.d/fix-ship-review-follow-ups.md b/changelog.d/fix-ship-review-follow-ups.mdnew file mode 100644index 000000000..94c64386c--- /dev/null+++ b/changelog.d/fix-ship-review-follow-ups.md@@ -0,0 +1 @@+**`/gstack-ship` closes five gaps in how it records reviews, and `--for gstack-ship` now installs the ship skill on Capy.** A ruled docs edit that adds a money, security or numeric claim now needs a fresh targeted read in both the review plan and the receipt; before, the receipt accepted the old read while the plan asked for a new one. A targeted-only read after the loop no longer hides an earlier full pass that stopped before its findings were logged. When a review is split into slices, a targeted record is no longer marked done if the slices don't cover the diff exactly, and a retry after an outside reviewer's cyber-policy refusal now skips the native reviewer's model family even when the native reviewer was sliced. `gstack-ship-budget check --next dispatch:<role>*<k>` reserves one reader per slice, so a sliced review is priced before it runs. The Capy skill now says `/gstack-ship` throughout, and the troubleshooting entry for `RECEIPT_CARRY_PRODUCT_CHANGED` lists the base-merge case that `docs/ship-policy.md` already allows.diff --git a/docs/ship-budget.md b/docs/ship-budget.mdindex 561a261d3..55a9b1f09 100644--- a/docs/ship-budget.md+++ b/docs/ship-budget.md@@ -203,7 +203,10 @@ measured means are per reader. A reader's prior is the calibrated per-dispatch cthe larger of the prior and the run's clean per-reader mean, and the price never drops below therole's own measured mean. When the whole batch does not fit, `check` admits the largest prefix that does andprints `ADMIT: k of n (remaining=<roles>)`: dispatch those k, then re-check the remaining roles-once they settle. Only a batch whose first reader does not fit stops, and `close` flags remaining+once they settle. A reader that `gstack-review-dispatch pass` slices into k slice readers+([review-policy.md](review-policy.md#review-ceiling)) is listed as `<role>*<k>` (k from 1 to 8,+for example `dispatch:specialist,adversarial-native*3`): each slice is priced and reserved as one+reader, and `ADMIT` never splits a slice set. Only a batch whose first reader does not fit stops, and `close` flags remainingroles no later check requested (`DROPPED:`, status=incomplete until the owner accepts).Roles are review-depth's: `specialist`, `red-team`, `adversarial-native`, `outside-voice`,`fix-check`, plus `docs`, the Step 14.5 documentation audit, which takes no review-log start anddiff --git a/docs/troubleshooting.md b/docs/troubleshooting.mdindex 2917ca864..bf3fe9c7d 100644--- a/docs/troubleshooting.md+++ b/docs/troubleshooting.md@@ -7781,7 +7781,11 @@ changed as product (every changed line at a branch-added position, the modeunchanged, the base not touching the file), a stamp file the branch changes byno more than a stamp against each head's base (a changelog-fragment conversionthat puts `package.json` back at the base's content), base context next to unchanged-hunks, or hunks the base merge spliced after a clean scoped review ([`RECEIPT_CARRY_SCOPED_REVIEW`](#receipt-carry-scoped-review)), which the+hunks, a clean base merge that itself made some of the branch's exact changes so+those hunks left the branch's diff (a three-way replay of the reviewed change onto+the new base gives each current file's exact bytes and mode, regular files only;+reason `branch hunks the base landed identically (<paths>; …)`,+[ship-policy.md](ship-policy.md#receipt-carry)), or hunks the base merge spliced after a clean scoped review ([`RECEIPT_CARRY_SCOPED_REVIEW`](#receipt-carry-scoped-review)), which the`carry` object in the carried receipt records with the product patch-id andthe range-diff evidence ([unattended.md](unattended.md#the-terminal-line)).diff --git a/lib/review-scope.ts b/lib/review-scope.tsindex 8dd958f57..a0656237a 100644--- a/lib/review-scope.ts+++ b/lib/review-scope.ts@@ -377,7 +377,7 @@ export interface LedgerPass {started: number; fixCheck: boolean; ids?: string[]; /** The ledger's pass directory (p1, p2, fc): a pN with no review row of pass N is named unbound. */ name?: string;/** Every reader it collected was the targeted reader: the targeted-only read after the loop or a ruled edit (gstack-review-plan NEXT: targeted), which is not a review round, so no review row of its pass number backs it (GSTA-876 on #4853). */targetedOnly?: true;- /** Whether judge ran on it at all (a rejected judgment counts): a pN pass never judged that no row names, replaced by a later judged or named pass, was abandoned (voided) and counts nothing (GBEV-3); a fix-check ledger and the last pass are never voided. */ judged?: boolean;+ /** Whether judge ran on it at all (a rejected judgment counts): a pN pass never judged that no row names, replaced by a later judged or named pass that is not targetedOnly, was abandoned (voided) and counts nothing (GBEV-3); a fix-check ledger and the last pass are never voided. */ judged?: boolean;}export function ledgerPass(ledger: string, key = (id: string) => id): LedgerPass {const events = readLedger(ledger);@@ -425,7 +425,7 @@ export function summarizeReviewLoop(rows: readonly Record<string, any>[], since:const passes = loopRows.filter(r => r.skill === 'review');const named = (dir: string) => { const n = /^p(\d+)$/.exec(dir)?.[1]; return loopRows.some(r => (n !== undefined && r.skill === 'review' && String(r.pass) === n) || (Array.isArray(r.findings) && r.findings.some((f: any) => typeof f?.ledger_id === 'string' && f.ledger_id.startsWith(`${dir}/`)))); };const passNo = (p: LedgerPass) => (p.fixCheck ? undefined : Number(/^p(\d+)$/.exec(p.name ?? '')?.[1] ?? NaN));- const replaced = (n: number) => allPasses.some(q => (passNo(q) ?? NaN) > n && (q.judged !== false || named(q.name!)));+ const replaced = (n: number) => allPasses.some(q => (passNo(q) ?? NaN) > n && !q.targetedOnly && (q.judged !== false || named(q.name!)));const voidedAt = new Set(allPasses.flatMap((p, i) => { const n = passNo(p); return n !== undefined && Number.isFinite(n) && p.judged === false && p.ids?.length && !named(p.name!) && replaced(n) ? [i] : []; }));const voided = [...voidedAt].map(i => `pass ${allPasses[i]!.name}: its ledger was never judged and no review-log row names it (an abandoned pass), so its ${allPasses[i]!.ids!.length} collected findings are left out`);const ledgers = allLedgers.filter((_, i) => !voidedAt.has(i));diff --git a/lib/ship-budget-cli.ts b/lib/ship-budget-cli.tsindex 00404526e..e92f9ea53 100644--- a/lib/ship-budget-cli.ts+++ b/lib/ship-budget-cli.ts@@ -146,7 +146,7 @@ export function writeReturnFile(file: string, lines: string[]): void {*/export function decide(l: Ledger, step: string, next: Next, call: number | null, startThreshold = false, runtimeLines?: number): Outcome {if (l.mode === 'observe') return observed(l, step, next.kind === 'dispatch' ? `dispatch:${next.roles.join(',')}` : next.step, call);- if (next.kind === 'dispatch') return admitBatch(l, step, next.roles, call);+ if (next.kind === 'dispatch') return admitBatch(l, step, next.roles, call, next.entries);const p = projector(l);const nextId = next.step;const { prior, tokens: projected } = p.project(next);@@ -197,17 +197,20 @@ function observed(l: Ledger, step: string, next: string, call: number | null, li* same step requests them, and close flags any still left. Only a batch whose* first reader does not fit stops.*/-function admitBatch(l: Ledger, step: string, roles: string[], call: number | null): Outcome {+function admitBatch(l: Ledger, step: string, roles: string[], call: number | null, entries?: string[]): Outcome {const p = projector(l);const prices = roles.map(p.reader);const cost = (k: number) => prices.slice(0, k).reduce((a, b) => a + b, 0);+ const sizes = (entries ?? roles).map(e => Number(/\*([1-8])$/.exec(e)?.[1] ?? 1));+ const cuts = new Set(sizes.map((_, i) => sizes.slice(0, i + 1).reduce((a, b) => a + b, 0)));const t = tally(l);let k = roles.length;- while (k > 0 && !admits(t, cost(k), p.reserve, l.cap)) k--;+ while (k > 0 && (!cuts.has(k) || !admits(t, cost(k), p.reserve, l.cap))) k--;if (k === 0) return { stdout: stopLines(l, { call, next: `dispatch:${roles.join(',')}`, step, projected: cost(roles.length), reason: 'budget_exhausted' }), exit: 3 };const admitted = roles.slice(0, k), remaining = roles.slice(k), nextId = `dispatch:${admitted.join(',')}`;const lines = [budgetLine(l, { call, next: nextId, projected: cost(k), verdict: 'continue' })];- if (remaining.length) lines.push(`ADMIT: ${k} of ${roles.length} (remaining=${remaining.join(',')}); dispatch these ${k} now and re-check --next dispatch:${remaining.join(',')} after they settle`);+ const rest = entries ? entries.slice([...cuts].indexOf(k) + 1) : remaining;+ if (remaining.length) lines.push(`ADMIT: ${k} of ${roles.length} (remaining=${rest.join(',')}); dispatch these ${k} now and re-check --next dispatch:${rest.join(',')} after they settle`);if (l.cap === null) return { stdout: lines, exit: 0 };for (const role of roles) {const older = l.reservations.find(r => r.step === step && r.remaining?.includes(role));diff --git a/lib/ship-budget.ts b/lib/ship-budget.tsindex 68c862206..be4a734cb 100644--- a/lib/ship-budget.ts+++ b/lib/ship-budget.ts@@ -129,13 +129,18 @@ export function parseStep(raw: string | undefined, flag = '--step'): string {throw usageError(`${flag} '${raw ?? ''}' is not a ship step id; valid: ${SHIP_STEPS.join(', ')}; fix: use a step number from ship/SKILL.md.tmpl`);}-export type Next = { kind: 'step'; step: string } | { kind: 'dispatch'; roles: string[] };+export type Next = { kind: 'step'; step: string } | { kind: 'dispatch'; roles: string[]; entries?: string[] };+/**+ * `--next <step>` or `dispatch:<roles>`; `role*k` stands for the k slice readers of one sliced reader (lib/review-slices.ts), each+ * priced and reserved as one reader. `entries` keeps the listed items when one is sliced, so admission never splits a slice set.+ */export function parseNext(raw: string | undefined): Next {if (raw?.startsWith('dispatch:')) {- const roles = raw.slice('dispatch:'.length).split(',').filter(Boolean);+ const entries = raw.slice('dispatch:'.length).split(',').filter(Boolean);+ const roles = entries.flatMap(r => { const m = /^(.+)\*([1-8])$/.exec(r); return m ? Array<string>(Number(m[2])).fill(m[1]!) : [r]; });const bad = roles.filter(r => !(DISPATCH_ROLES as readonly string[]).includes(r));- if (roles.length === 0 || bad.length) throw usageError(`--next '${raw}' names unknown roles (${bad.join(', ') || 'none given'}); valid: ${DISPATCH_ROLES.join(', ')}; fix: list the plan's roles, e.g. dispatch:specialist,red-team`);- return { kind: 'dispatch', roles };+ if (roles.length === 0 || bad.length) throw usageError(`--next '${raw}' names unknown roles (${bad.join(', ') || 'none given'}); valid: ${DISPATCH_ROLES.join(', ')}, each optionally *<slices 1-8> for a reader gstack-review-dispatch pass sliced into that many slice readers; fix: list the plan's roles, e.g. dispatch:specialist,red-team or dispatch:specialist,adversarial-native*3`);+ return { kind: 'dispatch', roles, ...(roles.length !== entries.length ? { entries } : {}) };}return { kind: 'step', step: parseStep(raw, '--next') };}diff --git a/lib/ship-receipt-depth.ts b/lib/ship-receipt-depth.tsindex 2842b74a6..5561a8953 100644--- a/lib/ship-receipt-depth.ts+++ b/lib/ship-receipt-depth.ts@@ -617,14 +617,16 @@ export const plainDocsSince = (root: string, from: string, head: string, base: s/*** The owner's `edit:<path>` rulings (docs/ship-policy.md#ruled-edits) that clear every path the PR's own change moved from `from`* to `head`, release stamps aside (productChangeSince), each at its ruled bytes as finish and gstack-review-plan read them- * (ruledEdits); null when a path has no clearing ruling, is deleted, or the change cannot be built. A targeted record carries- * across such a change only when nothing in it carries a targeted class (parseReviewTargeted, HARN-1 #638).+ * (ruledEdits); null when a path has no clearing ruling, is deleted, the change cannot be built, or it is a docs claim+ * (docsChangeSince), which gstack-review-plan's targeted-only read still reads fresh (lib/review-targeted-delta.ts), so a ruling+ * never carries the record past it. A targeted record carries across such a change only when nothing in it carries a targeted+ * class (parseReviewTargeted, HARN-1 #638).*/export function ruledChangeSince(root: string, from: string, head: string, base: string): RuledNote[] | null {const edits = readRuledNotes(root).filter(n => n.finding.startsWith('edit:'));const change = edits.length ? productChangeSince(root, base, from, head) : null;const c = change ? collectCommit(root, from, change.since) : null;- if (!c || c.errors.length || !c.paths.length) return null;+ if (!c || c.errors.length || !c.paths.length || docsChangeSince(root, from, head, base)?.verdict === 'claim') return null;const { ruled } = ruledEdits(root, c.paths, head, edits);return ruled.size === c.paths.length ? [...ruled.values()] : null;}diff --git a/test/capy-skill-wrapper.test.ts b/test/capy-skill-wrapper.test.tsindex c0094bd98..ecb550858 100644--- a/test/capy-skill-wrapper.test.ts+++ b/test/capy-skill-wrapper.test.ts@@ -126,6 +126,17 @@ function fixture(opts: { minWrapper?: number; cloneAt?: 'A' | 'B'; next?: boolea}describe('capy skill bootstrapper (capy/skill/gstack/scripts/install.sh)', () => {+ // Value: protects=/gstack-ship's own name installs the ship skill: --for gstack-ship is --for ship in the check, its fix line and+ // the install; fails_when=the wrapper passes gstack-ship to gstack-doctor, which refuses it as an unknown skill;+ // seam=capy/skill/gstack/scripts/install.sh argument parsing+ test('--for gstack-ship is the same check and install as --for ship', () => {+ const f = fixture();+ const check = f.run(['--check', '--for', 'gstack-ship']);+ expect(check.last).toBe(`gstack: fail revision — installed 1.0.0 is below the supported minimum 1.0.1 (fast-forward available); fix: bash ${BOOT} --for ship (fast-forwards) (REVISION_BELOW_MINIMUM)`);+ const install = f.run(['--for', 'gstack-ship']);+ expect(install.status, install.stdout + install.stderr).toBe(0);+ expect(f.calls()).toEqual([`installer --root ${f.root} --for ship lock=1 rev=5 min=1.0.1 from=1.0.0`]);+ });test('the first line names the wrapper revision and path; bash -n passes for the bootstrapper and the full wrapper', () => {for (const file of [BOOT, path.join(REPO, 'bin/gstack-capy-session')]) {expect(fs.existsSync(file), file).toBe(true);@@ -638,7 +649,7 @@ describe('capy skill: vendored text and support file', () => {for (const token of ['--check', 'GSTACK_LAUNCH', '^gstack: ok', 'gstack: fail not-installed', 'gstack-pregate sealed', 'autoplan/DRIVER.md', 'first report']) {expect(text, token).toContain(token);}- const named = [...text.matchAll(/\b(?:bin\/)?(gstack-[a-z0-9-]+)\b/g)].map(m => m[1]).filter(n => n !== 'gstack-capy-skill');+ const named = [...text.matchAll(/\b(?:bin\/)?(gstack-[a-z0-9-]+)\b/g)].filter(m => m[0].startsWith('bin/') || text[m.index! - 1] !== '/').map(m => m[1]).filter(n => n !== 'gstack-capy-skill');const missing = [...new Set(named)].filter(n => !fs.existsSync(path.join(REPO, 'bin', n)) && n !== 'gstack-pregate');expect(missing).toEqual([]);expect(fs.existsSync(path.join(REPO, 'bin/gstack-pregate'))).toBe(true);diff --git a/test/gstack-capy-install.test.ts b/test/gstack-capy-install.test.tsindex 4f8574585..1265b5587 100644--- a/test/gstack-capy-install.test.ts+++ b/test/gstack-capy-install.test.ts@@ -168,6 +168,16 @@ describe('gstack-capy-install', () => {expect(g.calls().filter(l => l.startsWith('doctor '))).toEqual(['doctor --check --require claude,codex,patch,browse-bundle,browser GSTACK_EPHEMERAL=1']);});+ // Value: protects=/gstack-ship's own name certifies the ship workflow from the checkout's installer, which every bootstrapper+ // revision hands over to; fails_when=the installer passes gstack-ship to the doctor, which refuses it as an unknown skill;+ // seam=bin/gstack-capy-install --for parsing+ test('--for gstack-ship is --for ship: the doctor checks ship', () => {+ const f = fixture();+ const r = run(f, ['--for', 'gstack-ship']);+ expect(r.status, r.stdout + r.stderr).toBe(0);+ expect(f.calls().filter(l => l.startsWith('doctor '))).toEqual(['doctor --check --for ship GSTACK_EPHEMERAL=1']);+ });+test('a FAIL from the doctor is exit 1 with its trailer last and no launch file; usage errors exit 2', () => {const f = fixture();const r = run(f, [], { STUB_DOCTOR_FAIL: '1' });diff --git a/test/review-pass-voice-failures.test.ts b/test/review-pass-voice-failures.test.tsindex 5ae54d68c..8b39c057e 100644--- a/test/review-pass-voice-failures.test.ts+++ b/test/review-pass-voice-failures.test.ts@@ -5,6 +5,7 @@import { describe, expect, test } from 'bun:test';import { spawnSync } from 'node:child_process';import * as fs from 'node:fs';+import * as os from 'node:os';import * as path from 'node:path';import { READ_ONLY_RETRY } from '../lib/review-brief';import { planCyberRetry, type Manifest } from '../lib/review-pass';@@ -185,6 +186,22 @@ describe('Capy pass program (fake host, real bins)', () => {expect(chain(['google'])).toEqual(['outside-voice/astra-read-only', null]);});+ // Value: protects=a sliced native voice's family still counts as taken when an outside voice is retried after a cyber_policy+ // refusal, so a Google native voice skips the Gemini step; fails_when=retry looks up only the key adversarial-native and+ // misses adversarial-native#i/k (GSTA-876 follow-up on #4853); seam=gstack-review-dispatch retry with voice-models.json+ test('retry reads a sliced native voice\'s family from its adversarial-native#i/k keys (R95)', () => {+ const out = fs.mkdtempSync(path.join(os.tmpdir(), 'cyber-slice-'));+ try {+ const file = path.join(out, 'pass-manifest.json');+ fs.writeFileSync(file, JSON.stringify({ version: 1, pass: 'u2', out, readers: [{ reader: 'outside-voice', role: 'outside-voice', stage: 'voices', state: 'collected' }] }));+ fs.writeFileSync(path.join(out, 'voice-models.json'), JSON.stringify({ laneModel: 'anthropic/claude-opus-5-5', readers: { 'adversarial-native#1/2': { model_id: 'google/gemini-4-argon' }, 'adversarial-native#2/2': { model_id: 'google/gemini-4-argon' } } }));+ const error = path.join(ROOT, 'test/fixtures/cyber-policy/capy-latest-error.txt');+ const retry = (reader: string) => spawnSync(path.join(BIN, 'gstack-review-dispatch'), ['retry', '--manifest', file, '--reader', reader, '--error-file', error], { encoding: 'utf8', timeout: 30_000 }).stdout;+ expect(retry('outside-voice')).toContain('RETRY: reader=outside-voice/astra-read-only model=openai/gpt-6.2-astra');+ expect(retry('outside-voice/astra-read-only')).toContain('RETRY: exhausted reader=outside-voice/astra-read-only');+ } finally { fs.rmSync(out, { recursive: true, force: true }); }+ });+// Value: protects=only cyber_policy starts a retry: a failed voice whose host error is another provider failure, and a voice that reviews normally, each run exactly one outside voice; fails_when=any failure, or a success, dispatches an Astra or Gemini reader;// why_new=R95 (no new retries for anything else; negative control); seam=lib/capy-review-pass.js; no_claim=nonetest('a non-refusal failure and a normal review never retry (R95)', async () => {diff --git a/test/review-slices.test.ts b/test/review-slices.test.tsindex 59334cc17..1256235ce 100644--- a/test/review-slices.test.ts+++ b/test/review-slices.test.ts@@ -328,8 +328,9 @@ describe.skipIf(!POSIX)('slice guards', () => {expect(after.readers.filter(x => x.role === 'adversarial-native' && x.state === 'rendered')).toEqual([]);}, 300_000);- // Value: protects=the targeted-reader record a receipt reads is done only when every slice was collected, and counts every- // slice's findings; fails_when=a sliced targeted reader records done with a slice uncollected, or findings miss a slice;+ // Value: protects=the targeted-reader record a receipt reads is done only when every slice was collected and its slice set is+ // clean, and counts every slice's findings; fails_when=a sliced targeted reader records done with a slice uncollected, with+ // a dirty SLICE row (GSTA-876 follow-up on #4853), or findings miss a slice;// why_new=GST-4019 review (targetedRecord's sliced path had no test); seam=pass, stage voices, collect, verify --targeted-outtest.skipIf(!POSIX)('a sliced targeted reader records done only when every slice is collected, with findings summed', () => {const repo = fixture(Object.fromEntries(['billing', 'beta', 'gamma'].flatMap(d => Array.from({ length: 6 }, (_, k) => [`${d}/m${k}.ts`, `export const charge_limit_usd = ${k};\n` + src(`${d}${k}`, 290)]))));@@ -355,6 +356,13 @@ describe.skipIf(!POSIX)('slice guards', () => {expect(record()).toContain('status=failed');send(targeted.find(x => x.reader === last)!, finding);expect(record()).toMatch(/status=done findings=2 /);+ const events = fs.readFileSync(staged.ledger, 'utf8').trimEnd().split('\n').map(l => JSON.parse(l) as Record<string, any>);+ const tampered = events.filter(e => e.event === 'rendered' && e.reader === last).at(-1)!;+ tampered.slice.files_sha256 = '0'.repeat(64);+ fs.writeFileSync(staged.ledger, events.map(e => JSON.stringify(e)).join('\n') + '\n');+ const dirty = runBin(repo, 'gstack-review-dispatch', ['verify', '--ledger', staged.ledger]).out;+ expect(dirty).toMatch(/^SLICE targeted CHANGED /m);+ expect(dirty.match(/^TARGETED_RECORD: .*$/m)?.[0]).toMatch(/status=failed findings=2 /);}, 300_000);// Value: protects=a malformed --slice is a usage error before any ledger write; fails_when=3/2, 1/9, 0/1 or x is accepted;diff --git a/test/ship-budget-batch.test.ts b/test/ship-budget-batch.test.tsindex 3dd3d7cd8..399fab360 100644--- a/test/ship-budget-batch.test.ts+++ b/test/ship-budget-batch.test.ts@@ -90,4 +90,27 @@ describe('parallel dispatch admission near the cap', () => {expect(accepted.code).toBe(0);expect(accepted.out).toContain('ACCEPTED: 0 unreserved dispatches and 1 unfinished batches by Garry');});++ // Value: protects=a reader gstack-review-dispatch pass sliced into k slice readers reserves k reader units, so a sliced review+ // is priced before its slices run (GSTA-876 follow-up on #4853); fails_when=role*k is refused as an unknown role or reserves+ // one unit for k readers; seam=gstack-ship-budget check --next dispatch:<role>*<k>+ test('a sliced role reserves one reader unit per slice', () => {+ const h = fresh();+ const s = start(h, 100 * K.per_dispatch);+ const c = batch(h, s.run, ['specialist', 'adversarial-native*3'], 0);+ expect(c.code, c.out + c.err).toBe(0);+ expect(Number(h.field(c.out, 'RESERVATION', 'tokens'))).toBe(4 * K.per_dispatch);+ expect(h.field(c.out, 'RESERVATION', 'next')).toBe('dispatch:specialist,adversarial-native,adversarial-native,adversarial-native');+ });++ // Value: protects=near the cap a sliced reader is admitted whole or not at all, and the remainder re-check keeps its role*k form;+ // fails_when=ADMIT names part of a slice set, which the pass cannot dispatch (verify marks a partial set MISSING); seam=admitBatch+ test('near the cap a slice set is admitted whole or deferred whole', () => {+ const h = fresh();+ const s = start(h, 3 * K.per_dispatch + K.stop_overhead + 1);+ const c = batch(h, s.run, ['specialist', 'adversarial-native*3'], 0);+ expect(c.code, c.out + c.err).toBe(0);+ expect(c.out).toMatch(/^ADMIT: 1 of 4 \(remaining=adversarial-native\*3\); dispatch these 1 now and re-check --next dispatch:adversarial-native\*3 after they settle$/m);+ expect(h.field(c.out, 'RESERVATION', 'next')).toBe('dispatch:specialist');+ });});diff --git a/test/ship-budget-meter-contract.test.ts b/test/ship-budget-meter-contract.test.tsindex f3b0cf702..1b57064d7 100644--- a/test/ship-budget-meter-contract.test.ts+++ b/test/ship-budget-meter-contract.test.ts@@ -40,7 +40,7 @@ describe('the Capy meter is the agent\'s own jam counter', () => {expect(text, rel).toMatch(/thread_id: "<(?:this agent's|your) own jam id>"/);}const capy = read('capy/skill/gstack/SKILL.md');- expect(capy.slice(capy.indexOf('Token caps on /ship'), capy.indexOf('/ship reviewers on Capy'))).toMatch(/own jam id/);+ expect(capy.slice(capy.indexOf('Token caps on /gstack-ship'), capy.indexOf('/ship reviewers on Capy'))).toMatch(/own jam id/);});// Value: protects=a handoff child meters its own counter, which starts far below the parent's, and the parent charges the child's own delta; fails_when=verify-handoff baselines the child at the parent's reading (its own lower reading is rejected) or reconcile charges the parent's counter delta;diff --git a/test/ship-budget-meter-scope.test.ts b/test/ship-budget-meter-scope.test.tsindex 9931b6bce..4db9afb55 100644--- a/test/ship-budget-meter-scope.test.ts+++ b/test/ship-budget-meter-scope.test.ts@@ -181,8 +181,8 @@ describe('meter scope (GST-467)', () => {// why_new=GST-467, GST-3466 (the G1 trial: /ship runs in the calling thread); seam=none; no_claim=agent compliancetest('the Capy skill has the thread running /ship read its own counter and start no /ship subagent; docs/ship-budget.md keeps the tree scope and root replay pointer', () => {const skill = fs.readFileSync(path.join(ROOT, 'capy/skill/gstack/SKILL.md'), 'utf8').replace(/\s+/g, ' ');- expect(skill).toContain('tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /ship, its reviewers included)');- expect(skill).toContain('never start a subagent to run /ship');+ expect(skill).toContain('tools.thread.get({ thread_id: "<your own jam id>" })` (the thread running /gstack-ship, its reviewers included)');+ expect(skill).toContain('never start a subagent to run /gstack-ship');expect(skill).not.toContain('--reading-from this --meter-scope tree');const doc = fs.readFileSync(path.join(ROOT, 'docs/ship-budget.md'), 'utf8').replace(/\s+/g, ' ');expect(doc).toContain('--meter-scope tree');diff --git a/test/ship-budget-reader-drift.test.ts b/test/ship-budget-reader-drift.test.tsindex 7c7f0c3d3..f4f671924 100644--- a/test/ship-budget-reader-drift.test.ts+++ b/test/ship-budget-reader-drift.test.ts@@ -253,7 +253,7 @@ describe('the budget section states both contracts', () => {// why_new=the template test above never read the Capy skill; seam=none; no_claim=how often an agent obeys the prosetest('the Capy skill reads the meter inside the budget command\'s program and names no meter-only call', () => {const capy = fs.readFileSync(path.join(import.meta.dir, '..', 'capy', 'skill', 'gstack', 'SKILL.md'), 'utf8');- const caps = capy.slice(capy.indexOf('Token caps on /ship'), capy.indexOf('/ship on Capy is about a dozen calls'));+ const caps = capy.slice(capy.indexOf('Token caps on /gstack-ship'), capy.indexOf('/gstack-ship on Capy is about a dozen calls'));expect(caps.length).toBeGreaterThan(0);expect(caps).not.toContain('returning only that number');expect(caps).toMatch(/inside the same (?:execute )?program as the\s+`gstack-ship-budget` command/);@@ -263,7 +263,7 @@ describe('the budget section states both contracts', () => {// why_new=no test reads the pass order; seam=none; no_claim=the model's adherence (GSTA-167 replay 5: arm D walked Steps 9-9.4 in 27 calls)test('a review pass is one execute program: plan, review-log --start, BEFORE, create, poll, note with the pair, collect (Capy, observe mode); the admission-mode section keeps check and settle', () => {const capy = fs.readFileSync(path.join(import.meta.dir, '..', 'capy', 'skill', 'gstack', 'SKILL.md'), 'utf8');- const pass = capy.slice(capy.indexOf('/ship on Capy is about a dozen calls'), capy.indexOf('## Plan, approve, ship'));+ const pass = capy.slice(capy.indexOf('/gstack-ship on Capy is about a dozen calls'), capy.indexOf('## Plan, approve, ship'));expect(pass).toContain('Each review pass and Step 11 is one call to the checked-in pass program');expect(pass).toContain('gstack-review-dispatch program');expect(pass).not.toMatch(/one execute program per batch/);diff --git a/test/ship-budget.test.ts b/test/ship-budget.test.tsindex 3b88390e3..dd80f1145 100644--- a/test/ship-budget.test.ts+++ b/test/ship-budget.test.ts@@ -30,6 +30,9 @@ describe('parsing and the admission rule', () => {expect(parseNext('dispatch:specialist,red-team')).toEqual({ kind: 'dispatch', roles: ['specialist', 'red-team'] });expect(() => parseNext('7.7')).toThrow(/valid: 0.9, 1, 2/);expect(() => parseNext('dispatch:security')).toThrow(/unknown roles \(security\)/);+ expect(parseNext('dispatch:specialist,adversarial-native*3')).toEqual({ kind: 'dispatch', roles: ['specialist', 'adversarial-native', 'adversarial-native', 'adversarial-native'], entries: ['specialist', 'adversarial-native*3'] });+ expect(() => parseNext('dispatch:adversarial-native*9')).toThrow(/unknown roles \(adversarial-native\*9\)/);+ expect(() => parseNext('dispatch:adversarial-native*0')).toThrow(/unknown roles/);});test('exactly at the cap is admitted; one token over is not', () => {diff --git a/test/ship-driver.test.ts b/test/ship-driver.test.tsindex 9c71ee85a..891cdf4cd 100644--- a/test/ship-driver.test.ts+++ b/test/ship-driver.test.ts@@ -296,7 +296,7 @@ describe('shape', () => {test('the Capy skill points /ship at the driver with the autoplan line\'s shape', () => {const capy = read('capy/skill/gstack/SKILL.md');for (const s of ['autoplan', 'ship']) {- expect(capy).toContain(`For \`/${s}\` driven from Capy, read \`${s}/DRIVER.md\` in the checkout (\`~/.local/share/gstack/${s}/DRIVER.md\`)`);+ expect(capy).toContain(`For \`/${s === 'ship' ? 'gstack-ship' : s}\` driven from Capy, read \`${s}/DRIVER.md\` in the checkout (\`~/.local/share/gstack/${s}/DRIVER.md\`)`);expect(capy).toContain(`A checkout without that file predates it; follow its \`${s}/SKILL.md\` instead`);}expect(capy).toContain('--mode observe');diff --git a/test/ship-ruled-edit-targeted.test.ts b/test/ship-ruled-edit-targeted.test.tsindex a09a7f75e..f75a365a5 100644--- a/test/ship-ruled-edit-targeted.test.ts+++ b/test/ship-ruled-edit-targeted.test.ts@@ -111,6 +111,21 @@ describe('a Captain-ruled edit after the read-only final review (HARN-1)', () =>expect(p.stdout).not.toContain("--finding 'edit:VERSION'");expect(bind(repo, passHead, head).ok).toBe(false);});++ // Value: protects=a ruled docs edit that adds a money claim gets the fresh targeted read the plan asks for, and the receipt+ // refuses the record read before it, so plan and receipt agree (GSTA-883 ruled note on #4862); fails_when=the plan dispatches+ // the targeted reader while write binds the old record through the ruling; seam=ruledChangeSince and targetedDelta+ test('a ruled docs edit that adds a money claim: the plan reads it fresh and the receipt refuses the old record', () => {+ const { repo, passHead, head } = shipped({ 'docs/billing.md': '# Billing\n\ncharge() now caps spend at 30 USD per run.\n' });+ const ran = patchAt(repo, passHead);+ expect(rule(repo, 'docs/billing.md', head).status).toBe(0);+ const p = plan(repo, ['--range-base', passHead, '--targeted-ran', ran]);+ expect(p.status, p.stderr).toBe(0);+ expect(next(p.stdout)).toStartWith('NEXT: targeted (');+ expect(dispatches(p.stdout)).toEqual(['DISPATCH: targeted targeted effort=full classes=money']);+ expect(bind(repo, passHead, head)).toMatchObject({ ok: false, message: expect.stringContaining('the product changed after the read') });+ expect(bind(repo, head, head).ok).toBe(true);+ });});// Value: protects=the targeted-only read (one targeted reader on HEAD after a ruled edit, not a review round) counts as bound;@@ -140,3 +155,29 @@ describe('a targeted-only read has no review row and is not unbound (GSTA-876)',});});+// Value: protects=an interrupted full pass whose collected blocker no row logged stays unbound when a targeted-only read follows+// it; fails_when=the judged targeted-only ledger counts in replaced() and voids the full pass, so neither is named+// (GSTA-883 deferred note on #4862); seam=lib/review-scope.ts summarizeReviewLoop+describe('a targeted-only read never replaces an interrupted full pass', () => {+ const since = '2026-11-26T19:00:00Z';+ const rows = [{ skill: 'review', via: 'ship', pass: 1, timestamp: '2026-11-26T19:01:00Z', commit_full: '1'.repeat(40), findings: [] }];+ function ledger(name: string, reader: string, at: string, ids: string[], judged: boolean): string {+ const dir = path.join(fs.mkdtempSync(path.join(os.tmpdir(), 'targeted-replace-')), name);+ fs.mkdirSync(dir);+ dirs.push(path.dirname(dir));+ const file = path.join(dir, 'review-ledger.jsonl');+ const events = [{ event: 'rendered', reader, at }, { event: 'output', reader, ids }, ...(judged ? [{ event: 'judge' }] : [])];+ fs.writeFileSync(file, events.map(e => JSON.stringify(e)).join('\n') + '\n');+ return file;+ }+ test('p2 interrupted with a collected blocker, then a judged targeted-only p3: p2 is still unbound, and a judged full p3 still voids it', () => {+ const p2 = ledgerPass(ledger('p2', 'red-team', '2026-11-26T19:05:00Z', ['p2/red-team-1'], false));+ const blocker = [{ id: 'p2/red-team-1', locus: 'src/a.ts:3', raiser: 'red-team' }] as never;+ const targeted = ledgerPass(ledger('p3', 'targeted', '2026-11-26T19:10:00Z', [], true));+ expect(targeted.targetedOnly).toBe(true);+ const s = summarizeReviewLoop(rows, since, [blocker, []], [p2, targeted]);+ expect(s.unbound).toEqual(['pass 2 (ledger p2): no review-log row, so its fixes and dispositions cannot be counted']);+ const full = ledgerPass(ledger('p3', 'red-team', '2026-11-26T19:10:00Z', [], true));+ expect(summarizeReviewLoop(rows, since, [blocker, []], [p2, full]).unbound).toEqual(['pass 3 (ledger p3): no review-log row, so its fixes and dispositions cannot be counted']);+ });+});