Skip to content

/ship counts a clean recheck of granted fixes even when its brief was written just before the review started (GST-3523) - #4698

Merged
capy-ai[bot] merged 5 commits into
mainfrom
recheck-record-before-review-start
Nov 22, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
recheck-record-before-review-start

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

When an owner grants one recheck of a fix and it reads the fix clean, /ship now counts it, even when the review pass wrote the recheck's brief a moment before it took the review's start token.
Why: /ship only accepted the record of what the reviewer read if it was written after that start, so a clean recheck was not counted and the PR needed an owner's exception to finish (gbrain#10057).
Nothing to do.

What changed
  • The review pass writes the recheck's brief, which records the hunks the reader gets, and then takes the recheck's review start token. When gstack-review-dispatch mark --log-start records that start, it now re-dates the brief's hunks record, but only while the record's digest still matches the hunks file. So a record for hunks the reader never got is never attached.
  • It prints FIX_CHECK_HUNKS: restamped or not restamped so the pass shows what happened. An unreadable hunks file prints not restamped (hunks file unreadable) and still records the start instead of failing.
  • The record's fix list also keeps approval ids (a-…). It used to keep only reader finding ids and path:line:category fingerprints, so a grant naming ruled notes recorded an empty fix list and closed nothing (gbrain#10063).
Why

Two runs on gbrain hit this: gbrain#10057, where the brief was written about two seconds before the start token, and gbrain#10063, where the same timing plus the dropped approval ids left a granted recheck closing nothing.

Blast radius

Only the recheck's hunks record in lib/review-evidence.ts and the start-recording step in bin/gstack-review-dispatch. A record is re-dated only when its digest matches the hunks file at the moment the start is recorded; a clearing still needs the grant, the fix list and exactly one open blocker to agree on the same id, so approval ids can't close anything a grant didn't name.

Tests

test/fix-check-hunks-restamp.test.ts (new; Windows-curated like the other dispatch-bin tests):

  • A record written before the start is not attached on main, and after the fix it is attached with its digest and fix list.
  • Hunks edited after the render, a repeated start and a start for another kind of review re-date nothing.
  • A missing hunks file still records the start and says why nothing was re-dated.
  • The fix list keeps approval ids beside reader finding ids and fingerprints, and nothing extra.

Each case fails without its fix. CI's full free suite passed at this tree (run 45024757519).

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL sf-7060f709df5f security finding, details recorded privately
  • INFORMATIONAL sf-a45a04086dfe security finding, details recorded privately
Agent notes

GST-3523, same class as GST-3501 (#4691). Reported by GBRA-741 on gbrain#10057 (run ship4, grant a-6a2d74ebde72: hunks record 10:17:04.406Z, REVIEW_LOG_START 10:17:06.199Z) and gbrain#10063 (grant a-b306fda9cc20: render 12:29:07.561Z, row start 12:29:11.373Z). Pass 1's one red-team note (an unreadable hunks file failed the start) is fixed in 72dfa82. Evals: none affected (no prompt, template or judge changed). Coverage audit: no new test needed beyond the four cases above.

Documentation (Step 14.5 audit docs-4698b-1, inserted unchanged):

Status: updated. One factual edit, no blockers.

Scope: base 9055979 to head 72dfa82 (bin/gstack-review-dispatch, lib/review-evidence.ts, scripts/lib/windows-curation.ts, test/fix-check-hunks-restamp.test.ts, changelog.d/recheck-record-before-review-start.md). The worktree was clean before the audit. I searched the authored docs and templates for fix-check hunks, fix-list and render-record contracts.

Documentation health:

File Status
docs/review-policy.md Updated: a fix list's grant ids now include a-… approval ids
docs/ship-policy.md Current
ship/DRIVER.md Current
changelog.d/recheck-record-before-review-start.md Current

Coverage debt: the FIX_CHECK_HUNKS: line that gstack-review-dispatch mark --log-start prints is not documented, because no doc lists mark's output lines. Diagram drift: none.

Approvals

Plan: exempt: bug fix (merge-check correctness, GST-3523)

{
  "schema_version": 1,
  "pr": 4698,
  "head": "b47efc929ae358085a32aa68a743442db80bafca",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 36,
      "fail": 0,
      "skip": 0
    },
    "test": {
      "pass": 1760,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "test",
      "run": 45024757519,
      "attempt": 1,
      "tree": "bddc04a1e584de3438610990d9c4a1a306c71ee1"
    }
  ],
  "calls": 16,
  "session_kind": "unattended",
  "run": "ship-4698b",
  "head_tree": "bddc04a1e584de3438610990d9c4a1a306c71ee1",
  "product_patch_id": "2a9956654cf7fee3b6c677baa1a03934ca6ccf0c",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 28,
    "rules": "630fd3101899e28e",
    "base": "4bd15f8a3d7e159f61e8fe2d465cb20f4b0629c6",
    "registry": "4bd15f8a3d7e159f61e8fe2d465cb20f4b0629c6",
    "gate_scan": {
      "tagged": 0,
      "head": "b47efc929ae358085a32aa68a743442db80bafca"
    },
    "reasons": [
      "runtime=28"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @bddc04a1e584 (8 checks, current for b47efc929ae3)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45024757519/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=bddc04a1e584 tests=39077 skipped=69 runs=45024757519/1 profiles=ci-reuse/free-tests heads=b47efc929ae3 verified=2026-11-22T13:03:40.193Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/ and README.md (docs/review-policy.md updated; docs/ship-policy.md, ship/DRIVER.md and the changelog.d fragment read)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 2,
    "fixed": 1,
    "scope": "frozen",
    "rounds": 1
  },
  "gate_dispositions": []
}

… written just before the review started (GST-3523)

The review pass writes the recheck's brief, which records the hunks its reader gets, and only then takes the review's start token. The row only attached records written after that start, so finish did not count a clean recheck. Recording the start now re-dates that record, but only while its digest still matches the hunks file.

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 11:59
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
fixListNames kept only ledger ids and path:line:category fingerprints, so a grant naming approval ids recorded an empty fix list and closed nothing (gbrain#10063).

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=red-team
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 f528f5b into main Nov 22, 2026
76 checks passed
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