Skip to content

Step 11.5 keeps a reviewed head current across base-only merges (GST-3308) - #4577

Merged
capy-ai[bot] merged 4 commits into
mainfrom
step-11-5-base-merge-only
Nov 20, 2026
Merged

capy-ai[bot] merged 4 commits into
mainfrom
step-11-5-base-merge-only

Conversation

@garrytan

@garrytan garrytan commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

When main is merged into a pull request after its code review, /ship no longer throws that review away. If every commit since the review is a clean merge of the base branch and the pull request's own changes are byte-identical, gstack-review-read now reports the review as current, so /ship finishes without another review round. Nothing to do.

What changed
  • gstack-review-read passes a new check, baseMergeOnly in lib/ship-receipt-patch.ts, to reviewFreshness. It runs only when the current content differs from what a review row read, and accepts the head only when all of these hold:
    • every first-parent commit after the reviewed one is a two-parent merge whose second parent origin/<base> holds;
    • each merge's tree is exactly what git merge-tree --write-tree writes for its parents (no conflict resolution, no edit inside the merge);
    • the working tree is HEAD's;
    • the branch's product patch-id against the base (the same helper /ship already uses to keep a review across a rebuilt head) and its patch-id over every path are unchanged, so tests, release metadata and gate paths stay covered.
  • A CURRENT reason from this route names the reviewed base to pass as finish's --reviewed-base. A STALE reason now says which condition failed.
  • The patch-id helpers (patchId, productRules, productSpec, productPatchAgainstBase, verifiedOutputs) moved verbatim out of bin/gstack-ship-receipt into lib/ship-receipt-patch.ts so both callers share them. Their behavior does not change.
  • docs/ship-policy.md and docs/skills.md describe the new CURRENT case.
Why

harness-evals#515 read CURRENT at 630a9903. Main was then merged in cleanly (deed041c) to make 2d3ab19d, and Step 11.5 read both review rows STALE because it compared whole trees, so the run could not finish without a new review. On those real commits, baseMergeOnly returns ok with one clean merge, product patch-id a548b6b4 and reviewed base 9d1b1c83.

Blast radius

The only behavior change is a row that used to read STALE on other content; every other row returns what it returned before, and finish's own read of post-review fixes passes no base-merge check, so it is unchanged (lib/ship-release.ts, read). Eight cases in test/ship-finish-ruled-notes.test.ts reuse the #515 fixture: a clean merge reads CURRENT and finish --reviewed-base binds with behavior=0; an own edit, a conflict resolution, an edit inside the merge, base context moved beside the branch's product or test hunk, uncommitted changes, a merge of a branch main does not hold, and a rebase all stay STALE (script ran: 8 pass, 0 fail).

Test Coverage

Coverage: 12 new code paths, 8 tested before review (67%). Review added 2 tests for the side-branch merge and rebase refusals, so 10 of 12 are now tested. Still untested: a review row whose commit is missing or holds other content, and the import-failure fallback in gstack-review-read (both read STALE).
Tests: 1839 → 1839 files (+0 new files; 2 new cases in an existing file).

Pre-Landing Review

No blocking issues. One test gap was fixed (two new tests); the other findings are below the blocking floor and listed under Review notes. The second-model review (GPT-6.1 Sol) returned clean.

Review notes

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

  • INFORMATIONAL security finding, details recorded privately (two such findings)
  • INFORMATIONAL bin/gstack-review-read:60 No test covers the fail-closed import fallback.
  • INFORMATIONAL bin/gstack-review-read:55 A throw inside baseMergeOnly at call time drops the row as malformed instead of reading STALE; fails closed.
  • INFORMATIONAL lib/ship-receipt-patch.ts:180 Any merge-tree failure other than exit 1 is blamed on the git version; stderr is not included.
  • INFORMATIONAL lib/ship-release.ts:295 The new git work runs inside finish's 60 s gstack-review-read budget; results are cached per row, not per merge commit; not measured on large branches.
  • INFORMATIONAL lib/ship-receipt-patch.ts:177 Trusts the local origin/<base> ref and the default branch rather than finish's --base; a stacked PR fails closed at finish.
Exploratory QA

Smoke: bin/gstack-review-read in this checkout exits 0 with its rows; the eight-case describe passes (8 pass, 0 fail, 177 expect calls). No browser surface. No plan checks (none bound).

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Review bot comments

No review bot comments.

Scope Drift

Scope Check: CLEAN

Plan Completion

Plan completion audit: not run (no plan is bound to this branch; bug fix).

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. One factual correction, no blockers.

Scope: branch step-11-5-base-merge-only, base 29bff55dd8a1 to head d785b9db063f: 3 commits and 7 committed files (bin/gstack-review-read, bin/gstack-ship-receipt, lib/review-evidence.ts, lib/ship-receipt-patch.ts, test/ship-finish-ruled-notes.test.ts, docs/ship-policy.md, changelog.d/step-11-5-base-merge-only.md). Nothing staged, unstaged or untracked. Every doc referencing gstack-review-read or review freshness was checked.

Documentation health:

  • docs/ship-policy.md: current (the base-merge-only CURRENT rule is already documented)
  • changelog.d/step-11-5-base-merge-only.md: current
  • docs/skills.md: updated (the review-freshness paragraph now names the base-merge-only exception)
  • docs/standalone-binaries.md: current
  • docs/troubleshooting.md, docs/unattended.md, docs/review-policy.md: current

Coverage debt: baseMergeOnly (lib/ship-receipt-patch.ts) has a reference entry in ship-policy.md and a summary in skills.md, but no troubleshooting how-to for its STALE reasons (a common gap; /document-generate could fill it).

Diagram drift: none.

Tests
  • bun test test/ship-finish-ruled-notes.test.ts -t 'base-only merges' (local, at d785b9d): 8 pass, 0 fail, 177 expect calls
  • Free test suite in CI at 8fc1088 (run 44828267437): green, 38590 tests across 1720 files; 7 files are integration-only and not owed in this suite
  • macOS named regressions in CI (same run): green
Agent notes

Refs GST-3308
Refs p1/specialist-batched#1

Approvals

No approvals recorded for branch step-11-5-base-merge-only.
Plan: exempt: bug fix, no new functionality (R4)
Plan check: exempt bug fix

REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=6 fixed=1 scope=frozen unbound=1 ledgers_read=3 fix_checks=1 dispatches=4
Gate edits: none detected (2 listed, 1 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Pre-Landing Review: 9 issues — 1 auto-fixed, 2 asked (0 fixed, 2 skipped), 0 deferred, 6 noted
Outside review: openai/gpt-6.1-sol via host subagent, VERDICT: CLEAN
CI: free-tests run 44828267437 at 8fc1088, carried; requires-remote free-tests.yml/macos-named-regressions cleared by job 136606337263
Exploratory QA: smoke only (2 probes passed); no plan checks bound

{
  "schema_version": 1,
  "pr": 4577,
  "head": "8fc1088ca1cbc4da08b28e574aa3be923f28d314",
  "version": "1.102.1.0",
  "base": "main",
  "gate": {
    "tests": {
      "pass": 38590,
      "fail": 0
    }
  },
  "ci_carried": [
    {
      "lane": "tests",
      "run": 44828267437,
      "attempt": 1,
      "tree": "f373728d2ce952b04d3baf189bbe82c9e030f7bf"
    }
  ],
  "calls": 28,
  "session_kind": "unattended",
  "run": "/home/user/.capy/work/gsta-678-ship",
  "head_tree": "f373728d2ce952b04d3baf189bbe82c9e030f7bf",
  "product_patch_id": "f4289515314acdcf4e3a7a66048db73899abcd3a",
  "gstack_version": "1.102.1.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 381,
    "rules": "85b3923b1a978e41",
    "base": "ad65f62edff0740449b70cbab6f519e40316b10e",
    "registry": "ad65f62edff0740449b70cbab6f519e40316b10e",
    "gate_scan": {
      "tagged": 0,
      "head": "8fc1088ca1cbc4da08b28e574aa3be923f28d314"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=381"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @f373728d2ce9 (8 checks, current for 8fc1088ca1cb)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44828267437/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=f373728d2ce9 tests=38590 skipped=73 runs=44828267437/1 profiles=ci-reuse/free-tests heads=8fc1088ca1cb verified=2026-11-20T22:31:26.016Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, CLAUDE.md, AGENTS.md, CONTRIBUTING.md (153 docs) against the 7 changed files"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 6,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 2,
    "ledgers_read": 3,
    "unbound": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "gate_dispositions": []
}
{"head":"d785b9db063f138231a84eb42b01371f434300b0","run":"gsta-678-ship","status":"started","review_loop":{"passes":1,"blocking_found":0,"deferred":0,"noted":1,"fixed":1,"scope":"frozen","fix_checks":1,"rounds":2,"dispatches":{"specialist":3,"red-team":1}}}

…3308)

harness-evals#515 at 2d3ab19d: the merge lane merged main into a PR whose
review rows read CURRENT, and Step 11.5 read both STALE because it compared
whole trees. gstack-review-read now accepts a head that is the reviewed
commit plus clean merges of origin/<base> with the branch's patch unchanged,
using the receipt carry's patch-id helpers, moved to lib/ship-receipt-patch.ts.

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

trunk-io Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits November 20, 2026 21:42
…her content

A copy-installed root with bin and lib alone (setup-runtime-lib-command) could
not start gstack-review-read once it imported the receipt patch module, whose
imports reach crew/lib. Rows on the current content never need it, and a
missing module now leaves other-content rows STALE with a note.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=specialist-batched
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>
@capy-ai
capy-ai Bot merged commit 92c57ca into main Nov 20, 2026
76 of 77 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 21, 2026
- Habits from nine teams, written into gstack. (#4585)
- Three more habits from teams that run evals. (#4602)
- The /ship conductor trial plan gives its real-problem judge one more attempt on fresh labels after it missed its agreement bar twice, and stops the trial incomplete if it misses again (GST-3003). (#4611)
- The /ship conductor trial plan now stops a trial only at the final remote-gate refusal, gives both arms the same note that the brief overrides team rules, and counts every report the no-gstack arm returns (GST-3003). (#4609)
- The /ship conductor trial plan now ends a trial at the remote gate when its case base isn't main, gives the no-gstack arm a test runner, and audits every trial for exposure to the plan (GST-3003). (#4605)
- The /ship conductor trial plan now runs an uncounted pilot in every arm before its counted trials and takes one planned look at half the cases (GST-3003). (#4587)
- gstack's own use on Capy can be counted, and is kept out of real-use numbers. (#4576)
- Free Tests shards finish closer together. (#4578)
- The weekly test-time recording can land again on its own. (#4581)
- The job-log tree.json step's recommended sleep is long enough for real runners. (#4589)
- Pull requests no longer wait on the Trunk flaky-test upload, and the quick tier's flaky passes now reach Trunk. (#4579)
- Windows Setup E2E finishes sooner on install changes. (#4575)
- Skills no longer stop on Codex when they clean up temp files. (#4612)
- /review on Codex with OpenAI models no longer holds back a review that ran its adversarial pass. (#4622)
- Crew threads on Capy now check in at 500M own tokens, standing threads rotate at 250M and any subagent past 50M gets a look, half the old lines, because Capy's token counts read about half what they did before 2026-11-15. (#4582)
- gstack no longer offers to add a `## Skill routing` section to your project's CLAUDE.md. (#4629)
- The README and docs no longer say gstack makes your agent fix more bugs. (#4598)
- `/eval-plan` now writes eval plans that waste less money. (#4591)
- /cso checks every folder above a source file before it looks at the file, so it never looks through a symlinked folder. (#4592)
- Plan reviews no longer read a /design-review audit summary as the branch's design doc. (#4623)
- Node's built-in test files now run with `node --test` in repos that use vitest or jest. (#4626)
- A quarantined test that the runner skipped now fails the run instead of passing it. (#4590)
- A flaky free test is fixed: the spawnSync overflow check no longer fails about once an hour on CI. (#4613)
- Free Tests runs its shards on 16-core runners. (#4600)
- /office-hours asks for ground truth first. (#4468)
- Every startup session ends with a dated test. (#4468)
- /plan-tune's dream cycle now logs each send of your typed answers to Anthropic. (#4621)
- Landing a ready PR no longer depends on a hand-copied gate decision, and the ready note, release PR and squash message say the right thing. (#4596)
- /ship no longer asks for a fresh review because of a stacked parent that main already had. (#4580)
- Results PRs with large captured agent sessions can be reviewed. (#4574)
- /ship no longer stalls on review notes a reviewer already cleared, counts review rounds the way the review policy reads them, and keeps security findings out of the PR body. (#4595)
- /ship's review readers are now told never to stop processes they didn't start. (#4607)
- /ship's review no longer stops when Capy's own drive sync database grows past 100 MB. (#4606)
- /ship's preflight now honors your repository's time limit for rerunning CI-skipped tests, and tells you when a fresh worktree needs its packages installed. (#4608)
- The slowest free test file is now six files. (#4588)
- Step 11.5 keeps a reviewed head current across base-only merges. (#4577)
- On a Capy install, only the owner's opt-in sends telemetry. (#4597)
- New page: working across agent systems. (#4583)

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