Skip to content

v1.91.236.0 feat(ship-queue): require a current /ship receipt before READY, train build and train merge - #3438

Merged
capy-ai[bot] merged 15 commits into
mainfrom
capy/require-a-current-ship
Oct 26, 2026
Merged

capy-ai[bot] merged 15 commits into
mainfrom
capy/require-a-current-ship

Conversation

@garrytan

@garrytan garrytan commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3438,
  "head": "672e969a0e71936e9a911a9f0e80abb8bde873d1",
  "version": "1.91.224.0",
  "base": "main",
  "gate": {
    "remote-free-tier": {
      "pass": 21564,
      "fail": 0,
      "skip": 0
    },
    "paid-ship-rule-cases": {
      "pass": 3,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "pregate": "requires-remote cleared @00f89bb256db (1 checks, current for 672e969a0e71)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/40265151564",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/40265151564",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/40265154141",
    "pregate.json/remote_gate: remote-gate tree=00f89bb256db tests=21564"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      3431
    ],
    "flakes": []
  }
}

What changed

Before: gstack-ship-queue ready printed SHIP_RECEIPT: none in the PR body as information and still returned ok, so every PR in the pool was READY'd without a /ship run.
Before (gstack main): READY succeeds with no /ship receipt in the PR body.

After: ready refuses with QUEUE_RECEIPT_MISSING; the informational SHIP_RECEIPT line still prints and NEXT points at /ship.
After: the same command refuses (exit 3, QUEUE_RECEIPT_MISSING) because /ship never ran on this head. There is no flag around it.

After: with a receipt for this head in the PR body, READY is written as before.
After, once /ship wrote the receipt for this head: READY as before, with SHIP_RECEIPT: pr=42 head=<pin> … in the block.

Before: train build admitted a pin whose PR body had no receipt.
Before: train build --dry-run admitted the unshipped pin.

After: train build refuses the pin by PR number before any write, push or dispatch, dry run included.
After: train build refuses the pin, naming the PR, before anything is written, pushed or dispatched.

Why

Garry, 2026-10-25: "we should really be using the gstack ship skill before merging PRs, can you make sure we do that?" The queue had the information (the receipt /ship writes into the PR body) but never acted on it. Now the receipt is a precondition at every queue step, read from the PR body alone, so a lane cannot READY, a coordinator cannot build a train with, and a slot cannot merge, a PR that /ship did not run on at that head.

  • gstack-ship-queue ready refuses with QUEUE_RECEIPT_MISSING (no valid gstack-ship-receipt block) or QUEUE_RECEIPT_STALE (the receipt's head is not the head being READY'd, or its pr is another PR). The informational SHIP_RECEIPT: line still prints. Both codes are in lib/result-codes-release.ts (where the other QUEUE_* codes live) with docs/troubleshooting.md anchors and fix: clauses. The re-READY after a slot's stamp push accepts the receipt written for the pinned head when HEAD is the pin plus stamp files, or (from slot 2 on) the pin with main merged in plus a stamp commit that changes at least one stamp file; a bare merge of main, an empty commit over it, or a pin-side edit after /ship is stale (docs/ship-policy.md#ship-before-ready).
  • train build refuses a pin whose PR has no current receipt with the same codes, naming the PR, before any write, push or dispatch, --dry-run included (prInfo now reads the body).
  • verify --train refuses the slot the same way before MERGE_CONDITION, and accepts a receipt written for the slot's pinned head when the current head is its stamp commit.
  • gstack-ship-receipt result (new, for GBRA-108's merge check) is /ship's terminal step (new Step 22): it binds the posted receipt to HEAD, writes <state root>/ship/runs/<utc>-<head12>/{ship-run.json,ship-receipt.md} (a /ship record, not a run v1 manifest) and prints GSTACK_RESULT: skill=ship status=complete run=<dir>; status=refused run=- with the receipt code when the receipt is missing, stale, or HEAD is not the PR's pushed head (exit 3); status=incomplete run=- when gh cannot read the PR or its head, or the record cannot be written (exit 1). --head must be a full commit id; --pr a PR number.
  • ready --screen refuses a stale merge ref with the new QUEUE_SCREEN_STALE_REF (GSTA-95 on v1.91.227.0 fix(windows): shell bins pass NUL as Bun's empty config when MSYS path conversion is off (#3415) #3431): GitHub stops recomputing refs/pull/<n>/merge while the PR conflicts with the base (CHANGELOG-only conflicts included), so a screen dispatched there planned 0 cases, reported success and ready printed SCREEN_DISPATCH: as if a screen ran. ready now fetches the merge ref and requires its second parent to be the PR head (a missing ref or a failed fetch carries the same code with its own message), and never follows a finished screen that planned no cases: a superseded run skips plan-slices and uploads no paid-plan artifact, and a manifest with nothing planned counts the same. train build prints SCREEN: #<n> run <id> planned no cases …; counted as not-run and seats that slot unscreened; a plan it cannot read prints … counted as screened, unverified. Consequence for lanes: a PR that conflicts with main (even on CHANGELOG alone, rule 14) can READY only with --no-screen until the conflict is resolved.
  • Unattended /ship may update an existing PR's body (GSTA-85 b): gstack-skill-start's unattended block and UNATTENDED_SHIP: line, Step 18 and docs/unattended.md say that when an open PR for the branch exists and HEAD is its pushed head, Step 18 takes the pr-body section's existing-PR path (body with the receipt first, and title) through gstack-post; it never runs pr-create, never pushes, never runs gh pr ready. Anything else takes the handoff section.
  • INSTALL_UNVERIFIED with no verdict names the directory to install from (GSTA-85 a): both twins now say run … scripts/install.sh --for ship from <project>: the verdict is keyed by the project directory the installer runs in; docs/troubleshooting.md#install-unverified shows the project-keyed verdict path.
  • GSTA-91 doc item: the unattended directive in hosts/claude/hooks/auq-error-fallback-hook.ts, docs/unattended.md and gstack-skill-start's per-skill block agree on which skills print GSTACK_RESULT: /autoplan and /eval-plan (gate_pending), /ship (Step 22), and nobody else except a refused install check.
  • Receipt-derived text printed anywhere (SHIP_RECEIPT:, the stale message, the receipt is invalid (…) reason, capped at 200 characters) goes through one scrub that collapses C0/C1 controls and the Unicode line separators, so the summary is one physical line. result refuses --pr together with --body (usage), rejects a --pr with leading zeros, lowercases --head, and reports an unreadable --body file as status=incomplete.
  • ready --screen names a failed ls-remote (could not list <remote>'s refs: …) and a failed merge-ref fetch (could not fetch refs/pull/<n>/merge from <remote>: …) under QUEUE_SCREEN_STALE_REF, never blaming the conflict for a transport error; train build prints SCREEN: #<n> the repository slug is unreadable; counted as screened, unverified instead of staying silent.
  • An unreadable or unsupported install verdict is told apart from a missing one in both twins (lib/install-verdict.ts, bin/gstack-install-verdict.sh): the install verdict at <file> is unreadable or has an unsupported schema_version; rerun the installer.

Not changed: gstack-ship-queue stamp and the per-PR verify have no GitHub access today; the stamped head is checked by verify --train. Hand-typed receipts are not detected: this is a process gate, as docs/ship-policy.md says.

Refs #3431

Approvals

Date Ask Garry's words Covers Pending
2026-10-25 Use /ship before merging PRs; make the tooling enforce it "also we should really be using the gstack ship skill before merging PRs, can you make sure we do that?" This PR: receipt enforcement in ready / train build / verify --train, the /ship result line, the unattended body update, the GSTA-95 stale-ref screen fix and the GSTA-91 doc item none

The size-budget raise above is a test-budget edit, not an eval threshold; listed here for the reviewer.

Gate edits

This strengthens. Every edit to a test, fixture or budget, listed:

  • test/helpers/ship-queue-train-fixture.ts: openPr writes a valid receipt for the head it opens (shipped: false leaves the body empty); new shippedBody, setPrBody, mergeRefCommit (refs/pull//merge is now a real merge commit, as GitHub keeps it); the gh shim gained plan rules (a paid-plan manifest per dispatched run, null for none, as a superseded screen), an artifacts listing that honours ?name=, and writes manifest.json beside a gate-reuse.json. Existing train tests keep passing because their PRs are now "shipped"; no assertion was weakened.
  • test/gstack-ship-queue.test.ts: the READY-block test's shim bodies carry a receipt for the head; the test gains the missing, invalid and stale refusals; ready at a stamp commit (slot 1, slot 2 with main merged in) accepts the pin's receipt, while a bare merge, an empty commit over it, and a pin-side edit are QUEUE_RECEIPT_STALE.
  • test/ship-queue-train.test.ts: rule-22 tests for ready, train build (dry run and live) and verify --train; --screen refuses a lagging, missing or unfetchable merge ref (an fsck-rejected merge commit stands in for the failed fetch) and dispatches nothing; a hollow screen (no paid-plan, or an empty manifest) is never followed and rides unscreened in train build, a live or in-progress screen stays screened, an unreadable manifest, an expired artifact or an unreadable slug prints the unverified line; a failed ls-remote is refused by name.
  • test/gstack-ship-receipt.test.ts: the bindReceipt head-matching table (12-character floor, other PR, one-line SHIP_RECEIPT:), result from a PR and from the handoff file, refusals for a missing/stale receipt and an unpushed HEAD, status=incomplete for a gh failure, a missing headRefOid and an unwritable --out, a relative --out, an unreadable --body, --pr with --body, the capped invalid-receipt reason, and --head validation (full lowercase id).
  • test/install-verdict.test.ts: the GSTA-85 case, a corrupt verdict file and an unsupported schema_version in both twins. test/gstack-skill-start.test.ts: the UNATTENDED_SHIP: line and the ship record rule (result line, existing-PR body update, never gh pr ready). test/auq-error-fallback-hook.test.ts: the unattended directive names the same GSTACK_RESULT writers as docs/unattended.md.
  • test/helpers/carve-guards.ts (size budget, raised): ship maxSkeletonBytes 81,000 → 81,600 and maxSizeRatio 1.6690 → 1.6740, with measured notes (skeleton 81,535; union 314,027 / 187,706 = 1.6730). Steps 14, 16, 18 and 20 prose were tightened to offset most of Step 22 and the Step 18 routing. No eval threshold, trial count or case kind changed.
  • test/fixtures/workflow-required-steps.json (strengthens): pins ## Step 22: Terminal line (every run).
  • Generated: ship/SKILL.md, ship/sections/{pr-body,handoff}.md, test/fixtures/golden/*-ship-SKILL.md, bin/gstack-doctor-components.sh (gstack-regen check fresh).

Summary

Three themes over 14 commits on capy/require-a-current-ship (37 files, +1152/−149):

  • Receipt enforcement in the queue: gstack-ship-queue ready, train build and verify --train read the gstack-ship-receipt block from the PR body and refuse QUEUE_RECEIPT_MISSING / QUEUE_RECEIPT_STALE before any write, push or dispatch; stamp commits over a pin (slot 1 stamp files only; slot 2+ the pin with main merged in plus a stamp that changes a stamp file) keep the pin's receipt.
  • /ship's terminal line and record (GBRA-108): new gstack-ship-receipt result and ship Step 22 print GSTACK_RESULT: skill=ship status=complete|refused|incomplete run=<dir> and write ship-run.json; the unattended lane may update an existing PR's body through gstack-post and never runs pr-create, a push or gh pr ready (GSTA-85 b, GSTA-91 doc item).
  • Screens and verdicts (GSTA-95, GSTA-85 a): ready --screen refuses a stale, missing or unfetchable merge ref with QUEUE_SCREEN_STALE_REF, a hollow screen (no paid-plan artifact or an empty plan) is never counted as a screen, and the install-verdict twins name the project directory to install from and tell an unreadable verdict from a missing one.

Test Coverage

All new code paths have test coverage (Step 7's coverage diagram did not run in this unattended lane; the rows are listed under Gate edits above).
Tests ran: remote free tier 21564 (tree 00f89bb256db, 752 files, 0 failed, $0.06)
Tests ran: focused test/gstack-ship-queue.test.ts test/ship-queue-train.test.ts test/ship-queue-train-logic.test.ts test/gstack-ship-receipt.test.ts test/install-verdict.test.ts test/troubleshooting-anchors.test.ts test/auq-error-fallback-hook.test.ts test/gstack-skill-start.test.ts test/parity-suite.test.ts (308) test/module-size-ratchet.test.ts test/spawnsync-timeout-tripwire.test.ts: all pass at HEAD
Tests ran: paid ship rule cases safety-ship-stale-evidence ($0.11), ship-local-workflow ($0.05), ship-triage ($0.09): PASS 1/1 each at 4afaa98 (no ship prose, bin/gstack-skill-start or hosts/ change since)

Pre-Landing Review

Eleven review cycles (Step 9.4 /review with the Review Army specialists: testing, maintainability, security, performance, simplification, state-machines, red-team in cycle 1) and seven native adversarial passes, all records finished against their start tokens; the final pair is bound at tree 00f89bb256db (review_binding: verified, freshness CURRENT). Fixed along the way: a missing import in lib/ship-queue-train-github.ts, the slot-2 stamp rule (bare merge, empty commit and pin-side edit are stale), result refusing an unpushed HEAD and status=incomplete on gh or record failures, the hollow-screen detector keyed on the paid-plan artifact with a validated run id and a named artifact listing, the SCREEN: lines for hollow and unverified screens, --head/--pr/--out validation, the ls-remote refusal, the capped one-line receipt errors, and the unreadable-verdict branch in both twins. Accepted as design, with reasons on the records: the receipt is a process gate (forgeable; pr optional for the handoff receipt); ready at a stamp commit is looser than verify --train's mergedIn check, which is the authority; the merge-ref check compares the second parent to the PR head (GSTA-95's ask), not the first parent to base; the bash verdict twin is a sed scrape that accepts a quoted schema_version the installer never writes; bidi and zero-width characters survive the one-line scrub (the JSON receipt, not the summary line, is the contract).
Gate edits: 30 listed, 30 read, 0 findings — 0 kept, 0 restored, 0 open (gstack-gate-diff tags none of them; each hunk is cited under Gate edits above).
Outside review: Codex unavailable (codex_reviews unset, codex not installed) — listed as missing coverage. Claude Code second opinion: covered by the seven native adversarial passes above.

Exploratory QA

Surfaces: gstack-ship-queue ready (with and without a receipt, at a stamp commit, --screen against a lagging, missing and unfetchable merge ref), train build --dry-run and live (hollow, live, in-progress, unreadable and expired screens), verify --train (pin receipt at slot 1 and slot 2 stamps), gstack-ship-receipt result (from a PR, from the handoff file, unpushed HEAD, missing headRefOid, unwritable and relative --out, unreadable --body), both install-verdict twins (missing, corrupt, unsupported schema). Every reproducer lives in the test files named under Gate edits with red/green proof (the rows fail on main's code). Not run: a live GitHub screen dispatch (this PR conflicts with main on CHANGELOG, so --screen is QUEUE_SCREEN_STALE_REF by design and READY uses --no-screen).

Design Review

No frontend files changed — design review skipped.

Eval Results

Ship prose changed (ship sections, bin/gstack-skill-start, the Claude hook), so the three skill-level paid rule cases ran focused: safety-ship-stale-evidence PASS, ship-local-workflow PASS, ship-triage PASS (1 trial each, $0.25 total). No case kind, threshold or trial count changed. The full gate runs at the train.

Greptile Review

No Greptile comments.

Issues

Refs #3431

Verification Results

Step 8.1 obligations executed at Step 9: 6 PASS (bun run typecheck; bun run typecheck:test 819 known, none new; gstack-regen check fresh; focused tests; remote free tier 21564/0; paid ship cases 3/3), 0 FAIL, 0 BLOCKED, 1 NOT RUN (a live --screen dispatch; not applicable while the PR conflicts with main). Pregate: local gstack-pregate run exit 0 and PREGATE_REMOTE: tree=00f89bb256db… tests=21564 failed=0; the macOS and Windows requires-remote lanes cleared with this branch's CI runs 40265151564 and 40265154141 (all green at 672e969).

TODOS

No TODO items completed in this PR.

Documentation

Scope. The /document-release read-only audit (ship-20261026T034014Z-672e969) read the user-facing literals from hollowScreen, admitSlots, the QUEUE_SCREEN_STALE_REF refusals, gstack-ship-receipt result, QUEUE_RECEIPT_* and the install-verdict twins, and checked each against docs/troubleshooting.md, docs/ship-policy.md, docs/unattended.md and CHANGELOG [Unreleased]; it also checked the three GSTACK_RESULT sources (the Claude hook directive, docs/unattended.md, gstack-skill-start's per-skill block) against each other.

Result. Current. gstack-regen check is fresh, test/troubleshooting-anchors.test.ts passes (237), and nothing contradicts anything else. Earlier audits in this run (ship-20261026T025849Z-95cf833, ship-20261026T031102Z-da8bdb4 and two scoped checks) were blocked on literal mismatches that were fixed before this one.

Debt (not blocking). (1) docs/unattended.md and the CHANGELOG say status=incomplete only for "gh cannot read the PR"; the code also prints it for an unreadable body file, a missing headRefOid, a gh reply with no JSON, and an unwritable run record. (2) The CHANGELOG mentions the unreadable-verdict repair only in its tests line. (3) #queue-receipt-stale paraphrases rather than quotes HEAD <sha> is not PR #<n>'s pushed head ….

Test plan

  • bun run typecheck: zero errors
  • bun run typecheck:test: 819 known diagnostics, none new
  • bin/gstack-regen check --base main --allow-repo-commands: fresh (2 entries)
  • bun test test/gstack-ship-queue.test.ts test/ship-queue-train.test.ts test/ship-queue-train-logic.test.ts test/gstack-ship-receipt.test.ts test/install-verdict.test.ts test/troubleshooting-anchors.test.ts test/auq-error-fallback-hook.test.ts test/gstack-skill-start.test.ts test/parity-suite.test.ts test/module-size-ratchet.test.ts test/spawnsync-timeout-tripwire.test.ts: all pass
  • gstack-pregate run --allow-repo-commands + gstack-pregate --stage tests --remote --spend-cap 2 --timeout 2700 --allow-repo-commands: 21564 tests, 0 failed on tree 00f89bb256db ($0.06)
  • bun run scripts/test-paid-shards.ts --tier gate --case <safety-ship-stale-evidence|ship-local-workflow|ship-triage>: PASS 1/1 each
  • CI Free Tests (40265151564) and Windows Free Tests (40265154141) at 672e969: green

🤖 Generated with Claude Code

… build and train merge

Garry, 2026-10-25: use the gstack ship skill before merging PRs. ready printed
SHIP_RECEIPT: none as information and returned ok, so the pool was READY'd without
/ship. Now ready, train build (dry run included) and verify --train refuse with
QUEUE_RECEIPT_MISSING or QUEUE_RECEIPT_STALE from the PR body alone; verify accepts
the receipt written for the pinned head when the current head is its stamp commit.

gstack-ship-receipt result is /ship's terminal step (GSTACK_RESULT: skill=ship,
run dir with the head and receipt), unattended /ship may update an existing PR's
body, and INSTALL_UNVERIFIED with no verdict names the project directory to
install from (GSTA-85).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 13 commits October 26, 2026 01:17
…ip skeleton

Gate edit: test/fixtures/workflow-required-steps.json pins the new
"## Step 22: Terminal line (every run)" heading (strengthens: a later
edit that drops the terminal line turns the required-steps test red).
Steps 14, 16, 18, 20 and 22 prose tightened so the carve-guards raise
shrinks to 81,600 / 1.6740 (measured skeleton 81,535, union 314,027).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… stale merge ref, ship-run.json)

- ready accepts the pin's receipt at a slot's stamp commit (plus the slot-2
  merge of main), as verify --train already did; a real edit stays STALE
- ready --screen refuses QUEUE_SCREEN_STALE_REF when refs/pull/<n>/merge is
  missing or merges an older head; a finished screen that planned 0 cases is
  never followed, and train build seats that slot unscreened (GSTA-95 on #3431)
- gstack-ship-receipt result writes ship-run.json (a /ship record, not a run
  v1 manifest), validates --head, and prints status=incomplete on gh failures
- bindReceipt takes an optional pr and renders one-line SHIP_RECEIPT lines
- tests for every state-matrix cell the review named; the train fixture's
  merge ref is a real merge commit

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ipt reuse, 12-hex --head, one receipt scrub) and align the unattended hook text with the GSTACK_RESULT writers (GSTA-91)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ves --out and reports unwritable records; ready names a failed merge-ref fetch; unattended /ship never runs gh pr ready)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…t requires a full --head and fails closed without headRefOid, digits-only --pr) with tests for every cycle-3 branch

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ipwire)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tifact or nothing planned), correct two troubleshooting facts, and normalise result --pr

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…e, say when the plan is unreadable; lowercase result --head

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d; docs name every SCREEN: literal

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…of counting the screen silently

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…with --body, cap echoed receipt errors, tell an unreadable install verdict from a missing one

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…eadable slug and verdict (both twins); docs name the new literals

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…dable --body as incomplete, refuse unsupported verdict schemas in the bash twin

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title feat(ship-queue): require a current /ship receipt before READY, train build and train merge v1.91.236.0 feat(ship-queue): require a current /ship receipt before READY, train build and train merge Oct 26, 2026
@capy-ai
capy-ai Bot merged commit 6665e20 into main Oct 26, 2026
63 checks passed
garrytan added a commit that referenced this pull request Oct 26, 2026
…3438; Captain-approved)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant