Skip to content

Review leaves out copied open-source files that match their upstream byte for byte (GST-3298) - #4665

Merged
capy-ai[bot] merged 5 commits into
mainfrom
review-skips-verified-vendored-files
Nov 22, 2026
Merged

capy-ai[bot] merged 5 commits into
mainfrom
review-skips-verified-vendored-files

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Files a repo copies unchanged from an allowlisted open-source project, and that gstack verifies byte for byte against the pinned upstream commit, can now be left out of /ship's review under review_exclude_paths.
Why: verified upstream code doesn't need a reviewer, so its bytes no longer count toward the 2 MB reader limit, while every other keep rule still applies.
Nothing to do for repos without review_vendored: their review selection is unchanged (216 of 216 replayed commits identical).

What changed

Repos that copy whole open-source test suites hit the 2 MB reader limit, because review had to read every copied file as if the repo had written it. Now a file that a review_exclude_paths pattern matches, and that review_vendored verifies byte for byte against an allowlisted upstream at the pinned commit, counts as vendored content and can leave the reviewers' diff.

  • Agent prose, config, executables, links, .github/ and .gstack/, gate paths, credential lines and gate tags still keep a file. A gate-tagged upstream test file stays in review whole.
  • A verified vendored file still counts as code when review looks for files that name excluded content, so a file it names by full path stays in review exactly as it did before.
  • A file the branch drops from the manifest but keeps and changes stays in review. Only a file the branch deletes is checked against the old pin.
  • When a pattern matches a manifest the branch changes, nothing counts as verified and the plan prints REVIEW_VENDORED: unavailable.
  • gstack-review-plan fetches the upstreams and prints what verified and what didn't. The review dispatch and the final ship check read the same cache without the network, and the verified list is part of the selection the final ship check binds.
  • When unverified vendored files make a pattern keep too many files, the refusal names them and points at gstack-vendored-verify, which also stops trusting a cached copy of an upstream branch that was deleted.
Blast radius

The change is inside reviewExclude and only runs when the base branch declares review_vendored; gstack itself does not, and the no-loss replay over 216 first-parent commits in gstack, harness-evals and gstack-evals produced identical selections (replay fixture read and test run). The plan's JSON now carries the vendored check as vendored_selection; its only readers are the review dispatch, which reads the numeric count, and this PR's tests (callers read).

What this does not fix

harness-evals#504 still goes over the 2 MB reader limit: 161 gate-tagged upstream test files (5.83 MB, mostly skip markers) stay in review whole by design (5 more gate-tagged files, pyproject.toml, are shown as excerpts), so that PR needs a separate change.

Known limit

A machine whose vendored cache is empty verifies nothing, so the final ship check there refuses until gstack-vendored-verify --base <base> fills it.

Pre-Landing Review

This commit got one final full review with no fix round, because the PR had already been through two review rounds. The targeted reader for the gate path found nothing, and the second-model review completed. Seven findings were raised at blocking severity; none of them fails a test, breaks production or loses data or secrets. Each one either refuses to run instead of running wrongly, or says something wrong in a message, and only in repos that set review_vendored (none does today). Each is listed under Agent notes as a ruled note, and a follow-up PR closes them. Two missing tests are ruled notes too.

Review notes

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

  • INFORMATIONAL sf-73eeaff8b633 security finding, details recorded privately
  • INFORMATIONAL sf-949e084a49a4 security finding, details recorded privately
  • INFORMATIONAL lib/review-vendored.ts:119 The head's manifest chooses local and upstream prefixes, so verified upstream files such as conftest.py can land in directories where they run; a trust-model question.
Exploratory QA

Two command-line checks on owned local fixtures passed: gstack-review-plan --base main on gstack itself (no review_vendored) exits 0 and prints no vendored lines, and a vendored file one byte off its pin stays in review as code and is named as REVIEW_VENDORED_KEPT. The live fetch from real upstreams, a machine with an empty cache and lock timeouts were not probed.

Documentation

Scope: a read-only audit of review-skips-verified-vendored-files against main (head 184a50a), covering committed changes plus a check for staged, unstaged and new files (none found). It read the branch's doc edits (docs/vendored-code.md, docs/ship-policy.md, the changelog.d fragment) and searched the repository for related or stale mentions of review_vendored and REVIEW_VENDORED. Result: current. The new "What review leaves out" section and the updated review_vendored policy row match the code in lib/review-vendored.ts, lib/review-exclude.ts and bin/gstack-review-plan. The old "a later release lets" wording is gone, and docs/troubleshooting.md is still accurate. Debt: none found.

Tests
  • bun run test (CI, free-tests run 44987722587 at this commit): 1,741 files passed
  • bun test test/review-exclude-vendored.test.ts -t 'one changed byte': 1 pass, 0 fail
  • bun run typecheck: no errors (push guards at this commit)
Agent notes
  • No-loss replay (test/fixtures/review-pins/replays/GST-3298.json): reviewExclude from main 69ad103 and from this branch on each first-parent commit's collectCommit input, across gstack 56, harness-evals 60 and gstack-evals 100: 216 of 216 identical, 134 of them active selections. Script and rows are in the GST-3298 handoff.
  • PR 2 of 2 for GST-3298. PR 1 is Repos can prove copied open-source files match their upstream byte for byte (GST-3298) #4646 (69ad103). The decision to keep the gate floor unchanged is GStack Minder's (option A, 2026-11-22). The fix-check after the second round is GStack Minder's grant a-edfe18bc3dee at eeda36b.
  • This commit's final review (run ship-4665-184a50a) was read-only under R51. GStack Minder (GSTA-36) ruled all nine blocking or open findings as notes (option A, 2026-11-22).

Approvals

Approved: yes (record r-d26f0a64ecf9). The full approval record stays private.
Plan: approved (record r-c8f31452adaa)
Plan check: approved (record r-c8f31452adaa)

REVIEW_LOOP: passes=1 blocking_found=7 deferred=2 noted=3 fixed=0 scope=frozen open=5 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)
Ruled note: lib/review-vendored.ts:319:outside-voice at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:34:03.313Z) at 2026-11-22T05:34:16.680Z: A modified vendored file is checked only at the head, so restoring a locally patched file to its upstream bytes leaves review; only in repos that set review_vendored, and PR 3 closes it (approval a-b13086df6a82)
Ruled note: bin/gstack-review-plan:250:outside-voice at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:34:03.313Z) at 2026-11-22T05:34:16.991Z: Each plan run fetches the upstreams again inside the 180 s plan limit, so a stalled upstream stops the pass; it fails closed and only in repos that set review_vendored (approval a-03d29e662e66)
Ruled note: lib/review-exclude.ts:524:adversarial at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:34:03.313Z) at 2026-11-22T05:34:17.146Z: The keep-too-large refusal points at lines the plan does not print on a refusal and can overcount unverified vendored files; wrong wording only, fixed in PR 3 (approval a-465e2a55663a)
Ruled note: lib/review-exclude.ts:592:adversarial at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:34:03.313Z) at 2026-11-22T05:34:17.302Z: The reviewer disclosure says the manifest is in the diff even when it is unchanged; wrong wording only, fixed in PR 3 (approval a-1f8f70cbcd04)
Ruled note: lib/review-vendored.ts:326:outside-voice at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:34:03.313Z) at 2026-11-22T05:34:26.310Z: gstack-vendored-verify warms only the head's pins, so land on a clean machine refuses a re-pin with deletions; fails closed, only in repos that set review_vendored (approval a-34e2ec714f5c)
Ruled note: lib/ship-receipt-depth.ts:470:adversarial at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:36:38.150Z) at 2026-11-22T05:36:38.437Z: Land checks the selection against its own cache; an empty cache refuses with the wrong fix. Fails closed, code this PR did not change (approval a-d7269d3b7710)
Ruled note: lib/review-vendored.ts:201:adversarial at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:36:38.150Z) at 2026-11-22T05:36:38.558Z: A failed fetch overwrites good cached pins, so a later offline step refuses. Fails closed, code this PR did not change (approval a-56c03033262e)
Ruled note: lib/review-vendored.ts:207:testing at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:36:38.150Z) at 2026-11-22T05:36:38.652Z: Test gap: no test for dropping a cached branch ref after the upstream deletes the branch (approval a-d325179948a4)
Ruled note: lib/review-vendored.ts:330:testing at 184a50a ruled by GSTA-36 (relayed from GSTA-674:2026-11-22T05:36:38.150Z) at 2026-11-22T05:36:38.741Z: Test gap: no test that a working-tree edit to a vendored file keeps it in review (approval a-128876ba6d96)

{
  "schema_version": 1,
  "pr": 4665,
  "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1741,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44987722587,
      "attempt": 1,
      "tree": "2428166960b90058f833063ec01962f5eeac9dfe"
    }
  ],
  "calls": 18,
  "session_kind": "unattended",
  "run": "ship-4665-184a50a",
  "head_tree": "2428166960b90058f833063ec01962f5eeac9dfe",
  "product_patch_id": "817fdef5cb9a2f7bbdc03183a17b0f4b7906be3c",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 110,
    "rules": "630fd3101899e28e",
    "base": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "registry": "c2b4f0d2adfa66e11143b95d9a42023a09380212",
    "gate_scan": {
      "tagged": 1,
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4"
    },
    "reasons": [
      "gate-class",
      "runtime=110"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @2428166960b9 (8 checks, current for 184a50a95d11)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44987363669/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44987363703/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=2428166960b9 tests=38792 skipped=89 runs=44987722587/1 profiles=ci-reuse/free-tests heads=184a50a95d11 verified=2026-11-22T05:39:16.230Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md and CONTRIBUTING.md against the branch diff 69ad103..184a50a"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 7,
    "deferred": 2,
    "noted": 3,
    "fixed": 0,
    "scope": "frozen",
    "rounds": 1,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "eeda36b73147e6cdde2b5d0c36c80b288644d8cf",
      "pr": 4665,
      "by": "GSTA-36",
      "reason": "No-loss rule: a verified vendored file must still keep the non-vendored files it names. Strict consumers restore main's selection.",
      "at": "2026-11-22T04:19:54.791Z",
      "approval": "a-edfe18bc3dee",
      "stop_run": "ship-4665-05c130d",
      "findings": [
        "s11/outside-voice#1"
      ]
    }
  ],
  "ruled_notes": [
    {
      "finding": "lib/review-vendored.ts:319:outside-voice",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "A modified vendored file is checked only at the head, so restoring a locally patched file to its upstream bytes leaves review; only in repos that set review_vendored, and PR 3 closes it",
      "at": "2026-11-22T05:34:16.680Z",
      "approval": "a-b13086df6a82",
      "relayed": "GSTA-674:2026-11-22T05:34:03.313Z"
    },
    {
      "finding": "bin/gstack-review-plan:250:outside-voice",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "Each plan run fetches the upstreams again inside the 180 s plan limit, so a stalled upstream stops the pass; it fails closed and only in repos that set review_vendored",
      "at": "2026-11-22T05:34:16.991Z",
      "approval": "a-03d29e662e66",
      "relayed": "GSTA-674:2026-11-22T05:34:03.313Z"
    },
    {
      "finding": "lib/review-exclude.ts:524:adversarial",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "The keep-too-large refusal points at lines the plan does not print on a refusal and can overcount unverified vendored files; wrong wording only, fixed in PR 3",
      "at": "2026-11-22T05:34:17.146Z",
      "approval": "a-465e2a55663a",
      "relayed": "GSTA-674:2026-11-22T05:34:03.313Z"
    },
    {
      "finding": "lib/review-exclude.ts:592:adversarial",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "The reviewer disclosure says the manifest is in the diff even when it is unchanged; wrong wording only, fixed in PR 3",
      "at": "2026-11-22T05:34:17.302Z",
      "approval": "a-1f8f70cbcd04",
      "relayed": "GSTA-674:2026-11-22T05:34:03.313Z"
    },
    {
      "finding": "lib/review-vendored.ts:326:outside-voice",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "gstack-vendored-verify warms only the head's pins, so land on a clean machine refuses a re-pin with deletions; fails closed, only in repos that set review_vendored",
      "at": "2026-11-22T05:34:26.310Z",
      "approval": "a-34e2ec714f5c",
      "relayed": "GSTA-674:2026-11-22T05:34:03.313Z"
    },
    {
      "finding": "lib/ship-receipt-depth.ts:470:adversarial",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "Land checks the selection against its own cache; an empty cache refuses with the wrong fix. Fails closed, code this PR did not change",
      "at": "2026-11-22T05:36:38.437Z",
      "approval": "a-d7269d3b7710",
      "relayed": "GSTA-674:2026-11-22T05:36:38.150Z"
    },
    {
      "finding": "lib/review-vendored.ts:201:adversarial",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "A failed fetch overwrites good cached pins, so a later offline step refuses. Fails closed, code this PR did not change",
      "at": "2026-11-22T05:36:38.558Z",
      "approval": "a-56c03033262e",
      "relayed": "GSTA-674:2026-11-22T05:36:38.150Z"
    },
    {
      "finding": "lib/review-vendored.ts:207:testing",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "Test gap: no test for dropping a cached branch ref after the upstream deletes the branch",
      "at": "2026-11-22T05:36:38.652Z",
      "approval": "a-d325179948a4",
      "relayed": "GSTA-674:2026-11-22T05:36:38.150Z"
    },
    {
      "finding": "lib/review-vendored.ts:330:testing",
      "head": "184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4",
      "by": "GSTA-36",
      "reason": "Test gap: no test that a working-tree edit to a vendored file keeps it in review",
      "at": "2026-11-22T05:36:38.741Z",
      "approval": "a-128876ba6d96",
      "relayed": "GSTA-674:2026-11-22T05:36:38.150Z"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "b3f6f8b4843c0c30",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "817fdef5cb9a2f7bbdc03183a17b0f4b7906be3c",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  }
}
{"head":"eeda36b73147e6cdde2b5d0c36c80b288644d8cf","run":"ship-4665-05c130d","mark":"stop","tree":"13986e51c270cfc3ed3198a5a7769ae9c98817e2"}
{"head":"eeda36b73147e6cdde2b5d0c36c80b288644d8cf","run":"ship-4665-05c130d","mark":"grant","grant":"a-edfe18bc3dee"}
{"head":"184a50a95d11a4dc64cfd3e1f6c58b8c59ee19e4","run":"ship-4665-184a50a","mark":"stop","tree":"2428166960b90058f833063ec01962f5eeac9dfe"}

garrytan and others added 2 commits November 22, 2026 02:54
…ins (work in progress, GST-3298)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…byte for byte (GST-3298)

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 3 commits November 22, 2026 04:02
…till changes, and checks nothing when a pattern hides the manifest

A file the merge base's manifest pins now verifies at that pin only when the range deletes it. When a review_exclude_paths pattern matches a manifest, no file counts as verified, so readers see every file it pins.

Review-Finding: p1/specialist-batched#1 reader=specialist-batched
Review-Finding: p1/specialist-batched#2 reader=specialist-batched
Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… keeps its vendored count

Vendored files count as code when review looks for files that name excluded content, so every file that is not vendored keeps the selection it had on main. The plan's JSON now carries the vendored check under vendored_selection, so the numeric count reaches the reviewers' disclosure line.

Review-Finding: s11/outside-voice#1 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…3298)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot merged commit 9cfbbb9 into main Nov 22, 2026
78 of 79 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 22, 2026
… bytes (GST-3298) (#4690)

A branch that replaces your own file, or drops a local patch, so the
file now matches an upstream copy byte for byte no longer leaves review:
a changed file counts as vendored only if it was already vendored and
verified at the merge base, or is new on the branch.

This closes the gap the second-model review of #4665 found, so readers
always see your own lines leave. Nothing to do for repos without
`review_vendored`, which is every repo today.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/outside-voice#1 reader=outside-voice
Review-Finding: p1/outside-voice#2 reader=outside-voice
Review-Finding: p1/red-team#1 reader=red-team
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