Skip to content

/ship keeps its review count and grant claims honest, and a symlinked harness pin needs a fresh review (GST-3463) - #4703

Merged
capy-ai[bot] merged 8 commits into
mainfrom
ship-claim-and-rerun-history
Nov 22, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
ship-claim-and-rerun-history

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

/ship now keeps a PR's earlier runs when it rewrites the PR description, so later runs count review rounds correctly, and it refuses to start reviewers when it could not save a granted round's claim.
Why: both slips let a PR get more review rounds than the two-round limit allows, without anyone seeing it.
Nothing to do: the fixes apply on the next /ship run.

What changed

The problem: a PR could go past its two review rounds without anyone noticing. When Step 19 wrote a fresh description, the published body kept only the newest run, so the next run counted fewer rounds than the PR had. When the run record could not save a granted round's claim, gstack-ship-receipt claim still printed GRANT_CLAIMED, so a run could stop and grant itself the same round twice.

  • Rewritten descriptions keep earlier runs. gstack-ship-receipt write --pr, given a description file with no record or run history, reads the live PR description's earlier record and runs into it. If the live description can't be read, write says so with a RECEIPT_RUNS: line and keeps only this run.
  • A claim that wasn't saved fails. claim exits non-zero and says not to start reviewers when the run record exists but could not save the claim, and says to rerun with the same run id, because a new id would find the round already spent.
  • Shared harness pins. A pin that a main merge only re-recorded counts as already reviewed only when it is a regular file at both commits and both pinned files resolve. A pin turned into a symlink now needs a fresh review.
  • Docs audit wording. The docs audit steps say a re-audit names each earlier audit by its post snapshot, or with --carry-stopped and its Prepare snapshot when it stopped first. The review and ship policy docs describe the claim failure and the pin rule.
Why

"Make the pin mode check the first commit of PR 2", then items 1 and 4 of GST-3463: a claim that fails open and a description rewrite that undercounts rounds. Both are gaps in the check that limits each PR to two review rounds.

Blast radius

The changes touch gstack-ship-receipt claim and write, the harness-pin rule in lib/ship-receipt-patch.ts, and the /ship docs audit steps. Each change only adds a refusal or reads more history. The new live read runs only when the description file has no record and no runs, and a failed read warns and writes what it wrote before. Each new test fails on main, and CI's free suite passed at 49be1d4.

Test Coverage

The coverage audit read 10 changed paths. 7 have tests rated two or three stars and 3 have none (audit only, no tests generated):

  • A pinned file missing at one commit, when the pin has no blob field.
  • claim when no run record exists (it still claims and prints a RUN_RECORD: note).
  • write when the body already holds a record or runs, a live body with runs but no record, and --repo passed through to the read.

Tests: 1883 → 1883 test files (the three new test files were written before /ship). Coverage: 70% (7 of 10 paths).
Tests ran: tests reused from CI, run 45027568836 (1764 files, 39095 tests).

Pre-Landing Review

Round 1 (full panel) found three notes and fixed two: the claim error now says to rerun with the same run id, and the docs audit wording no longer says --carry-stopped replaces --carry. The third, making write fail when the live description can't be read, was skipped: it is no regression, and failing would stop every write made without GitHub access. Round 2 (full, on the fix range) and the second-model review (GPT-6.2 Sol) found only notes. A scoped reader read the docs audit's two policy edits clean.

Review notes

Below the blocking floor; recorded here and not fixed in this PR.

  • ship/sections/documentation.md.tmpl:106: the prose says --carry for each earlier audit and --carry-stopped for each stopped one, but the snapshot takes each flag once. The two-attempt limit means a re-audit has one earlier audit, and a repeat flag fails loudly.
  • No test runs --carry and --carry-stopped together in one snapshot.
  • bin/gstack-ship-receipt:1072: on Capy, where the description is handed to the host to publish, "the PR body already holds the claim" may not be true yet. Rerunning with the same run id is still right.
Exploratory QA

Smoke: the three new test files ran on the reviewed tree (10 pass, 0 fail). No plan checks; this is a bug fix with no plan.

Eval Results

No paid evals ran here. The PR screen selects 25 end-to-end cases (mostly /ship's own docs-audit cases) and no judges; they are not verified on this PR and run in main's paid gate after merge.

Scope Drift

Scope Check: CLEAN. Intent: GST-3463 items 1 and 4, the pin mode check and the docs lines deferred from #4693. Delivered: those, plus two test fixes CI found (a gh stub and a bin path).

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. Two factual doc edits, no blockers.

Scope: the committed diff from 25bf93c to 49be1d4 on ship-claim-and-rerun-history, plus the unstaged changelog fragment. It covers the harness-pin rule (when a re-recorded pin counts as reviewed), the claim failure when the run record can't save it, write --pr keeping earlier runs, and the --carry-stopped wording in the docs audit steps.

Documentation health:

  • docs/ship-policy.md: updated. The harness-pin row of the base-merge table now requires a regular-file pin and both pinned files to resolve.
  • docs/review-policy.md: updated. It now says what claim does when the run record can't save it: fail, start no reviewers, rerun with the same --run.
  • docs/troubleshooting.md: current (the --carry-stopped note is already there).
  • ship/sections/documentation.md.tmpl and documentation.md: current and matching.
  • ship/sections/review-army.md.tmpl: current.
  • changelog.d/ship-claim-and-rerun-history.md: current (reviewed, not edited).

Coverage debt: no troubleshooting entry for the claim failure when the run record can't save it. The RECEIPT_RUNS: warning from gstack-ship-receipt write --pr (printed when the PR's earlier runs can't be read) is undocumented. No diagram drift.

Tests
  • Free suite in CI (run 45026601626 at 49be1d4): pass
  • bun test test/ship-receipt-claim-fail-closed.test.ts test/ship-receipt-write-keeps-earlier-runs.test.ts test/ship-receipt-carry-harness-repin.test.ts: 10 pass
  • bun test test/gstack-ship-receipt.test.ts test/test-of-test-ratchet.test.ts: pass
  • bun test test/gstack-docs-candidate.test.ts test/parity-suite.test.ts test/size-ledger.test.ts: pass
  • bun run typecheck: clean
Agent notes

PR 2 of GST-3463 (items 1 and 4), plus the symlink-pin mode check ruled for this PR on #4669 (approvals a-1e8089baf227, a-aeeeea7dccf3) and the flag-wording and doc lines deferred from #4693's docs audit. The Documentation section is the docs audit's saved section with two wording changes for the plain-body check ("harness-pin carry rule/row" reworded, two flags put in code spans). The two policy edits that audit made were read clean by one scoped reader (finish's SCOPED_REVIEW line, not a round). Trial merge with #4705 (shares docs/troubleshooting.md): clean, typecheck clean, focused tests 30 pass. GEVA-559's round count (gstack-evals#406) was a different bug, a run id reused across heads, already fixed on main by #4654 (e8e7554) and tested in test/pr-review-history.test.ts.

Approvals

No approvals recorded for branch ship-claim-and-rerun-history.
Plan: exempt: bug fix with a failing test written first for each item (GST-3463)

Gate edits: none detected (9 listed, 5 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)

🤖 Generated with Claude Code

{
  "schema_version": 1,
  "pr": 4703,
  "head": "450d6bdad97b559cfed74fb100bd7362b45ff3db",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 39095,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 45027568836,
      "attempt": 1,
      "tree": "a1e471f8c5c12700b1be0195663f12994540290a"
    }
  ],
  "calls": 26,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/pr2/ship-4703-a",
  "head_tree": "a1e471f8c5c12700b1be0195663f12994540290a",
  "product_patch_id": "455a8922c4a154decfed46fa24fe379ef3d86aaa",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 48,
    "rules": "33831f8248a814fd",
    "base": "596ff8a7cc913d405e7682ac99106cdfa7aab7e9",
    "registry": "596ff8a7cc913d405e7682ac99106cdfa7aab7e9",
    "gate_scan": {
      "tagged": 0,
      "head": "450d6bdad97b559cfed74fb100bd7362b45ff3db"
    },
    "reasons": [
      "gate-class",
      "runtime=48"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @a1e471f8c5c1 (8 checks, current for 450d6bdad97b)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45027568836/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45027551954/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=a1e471f8c5c1 tests=39095 skipped=104 runs=45027568836/1 profiles=ci-reuse/free-tests heads=450d6bdad97b verified=2026-11-22T13:39:35.129Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "the committed diff 25bf93c4..49be1d47 plus the changelog fragment: the harness-pin rule, the claim failure, write --pr keeping earlier runs and the --carry-stopped wording"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 6,
    "fixed": 2,
    "scope": "frozen",
    "rounds": 2,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  },
  "gate_dispositions": []
}

garrytan and others added 4 commits November 22, 2026 12:32
…ular file and both pinned files resolve

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ers, when the run record could not save it

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…the PR's earlier runs, so later runs count review rounds correctly

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…audit flag, and the docs describe it

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

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 4 commits November 22, 2026 12:40
…es the bin directory it runs

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…says to rerun with the same run id

Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#3 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… harness pin do

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>
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