Skip to content

Repos can prove copied open-source files match their upstream byte for byte (GST-3298) - #4646

Merged
capy-ai[bot] merged 8 commits into
mainfrom
vendored-files-verified-against-upstream-pins
Nov 22, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
vendored-files-verified-against-upstream-pins

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

New gstack-vendored-verify checks that every file a repo copies from an open-source project is byte-for-byte that project's file, at a commit on its default branch, a tag or a branch the base names, from a repository the base branch trusts.
Why: harness-evals copies 1,056 upstream test files into its eval tasks and today hides them from review in tar archives; this proves the claim the archives only assert (1,054 of 1,056 verify on #504 in 19 seconds; 2 are upstream executables).
Nothing to do unless you vendor code: the new review_vendored policy key is off by default.

What changed
  • lib/review-vendored.ts: the review_vendored key's validation, the gstack-vendored/v1 manifest, and the check. Fetches go anonymously to each upstream over https with no ambient git config, prompt or redirect, and a timeout; commit history and each pin's file listing are cached under the state root, so --offline answers from the cache.
  • bin/gstack-vendored-verify --base <branch> [--all] [--offline] [--json]: one line per pin, one line per failure with its reason code and fix, exit 1 when a manifest claims something untrue. Meant as a required CI check.
  • A commit only a fork, a pull request ref or a merge-queue branch holds fails (VENDORED_UNREACHABLE), even when the base's branch glob is *; so does a force-pushed one. A named branch the upstream lacks is skipped instead of failing the other pins. Executables, symlinks, submodules, renamed files, local edits and unlisted upstreams fail with their own codes.
  • lib/ship-policy.ts registers the key (validation lives in the new module; ship-policy.ts stays at its 800-line cap). Eight result codes with troubleshooting entries; docs/vendored-code.md; a ship-policy.md key row; a changelog fragment.
  • /ship's review does not read the key yet; that is the follow-up PR.
Tests

test/review-vendored.test.ts (18 cases) builds local upstream repositories and runs the command against them: verified files; a one-byte edit; pull-ref, merge-queue and force-pushed pins; a base-named release/* branch; a deleted upstream; an upstream the head tries to trust for itself; a * glob that must still refuse a merge-queue commit; a named branch the upstream lacks; an upstream submodule; --json keeping its pin count; executable and renamed files; bad manifests; changed-only versus --all scope; --offline reusing the cache; and a 401 server and a hanging server, both failing without prompting or hanging. Every consumer repo's global git config rewrites the upstream root to a missing folder, so a fetch that read ambient config would fail.

Real run on harness-evals#504 (24a377ab with its tars unpacked and a generated manifest, 11 GitHub upstreams, 71 pins): checked=1056 verified=1054 failed=2, 19 s cold, 15 MB cache. The 2 failures are tests/test_rr.py in cachetools, executable upstream too (VENDORED_MODE).

Agent notes
Documentation

Status: blocked. One factual correction is needed, and read-only mode can't make it.

Scope: 7 commits (dd61103..b6d4150) that add gstack-vendored-verify, the review_vendored policy key, 8 VENDORED_* result codes and their doctor anchors. Docs audited: docs/vendored-code.md (new), docs/troubleshooting.md, docs/ship-policy.md and the changelog.d fragment, checked against bin/gstack-vendored-verify and lib/review-vendored.ts. AGENTS.md, CLAUDE.md and README.md are unaffected.

Documentation health:

  • docs/vendored-code.md: current (flags, exit codes 0 to 3, timeout env var and manifest rules all match the code)
  • docs/troubleshooting.md: current (all 8 anchors match the result codes)
  • changelog.d/vendored-files-verified-against-upstream-pins.md: current
  • docs/ship-policy.md: needs a fix. The review_vendored row leaves out pins from branches the base policy names ({ url, branches })

Coverage debt: gstack-vendored-verify has reference, how-to and explanation coverage in docs/vendored-code.md but no tutorial. That's a common gap and doesn't block. No architecture diagram drift was found.

Documentation exception: accepted by GSTA-674 lane 2026-11-22 via GSTA-674 lane message to its /ship subagent, 2026-11-22 (option A): docs/ship-policy.md's review_vendored row leaves out base-named branches; the one-line fix ships in PR 2 (GST-3298)

Plan: handoffs/GST-vendored-review/plan.md, approved by Garry 2026-11-20 ("Do it"), autoplan run run-gfzivt-20261120181333. PR 1 of 2; PR 2 hooks review-exclude after #4574. /ship receipt follows.

Review (round 2 of 2 at 9e8fc0c, then one granted fix round at fb104d7, grant a-6c204277323f): the blocking finding (a * branch glob admitted merge-queue holders, outside voice gpt-6.1-sol, also security specialist and native reader) and native FIXABLE #1 (missing named branch failed every pin) and #5 (submodule code, --json pin count) are fixed in fb104d7 with regression tests that fail without the fix. Fix-check: 0 blocking.

Ruled note: lib/review-vendored.ts:204:adversarial at b6d4150 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-22) at 2026-11-22T02:15:24.504Z: fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking (approval a-178a91105af1)
Ruled note: lib/review-vendored.ts:173:adversarial at b6d4150 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-22) at 2026-11-22T02:15:24.714Z: fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking (approval a-bf2361775b93)
Ruled note: bin/gstack-vendored-verify:1:adversarial at b6d4150 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-22) at 2026-11-22T02:15:24.871Z: fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking (approval a-77b6919c52f0)
Ruled note: lib/review-vendored.ts:173:outside-voice at b6d4150 ruled by Captain GStack Minder (GSTA-36) (relayed from GSTA-36:2026-11-22) at 2026-11-22T02:15:25.045Z: fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking (approval a-46065a7c1bb4)

Open notes (below the floor, not fixed here):

  • Open: after an upstream deletes a branch the base names, a reused cache keeps refs/vendored/heads/<b> (the fetch skips that refspec, so --prune does not remove it), and a pin only that branch held still verifies. PR 2 fixes it with git update-ref -d for each skipped branch before anything uses the verdict.
  • docs/vendored-code.md's CI snippet needs a full-history checkout (fetch-depth: 0); with a depth-1 checkout the merge base cannot be resolved and the command exits 3.
  • --offline trusts the cache with no age limit, so an upstream force-push is not seen offline.
  • The lock gives up after about 60 s and the command exits 1 with a stack trace instead of exit 3 with a reason; the lock is never refreshed, so a run over 10 minutes can lose it.
  • No test commits a symlink at a pinned path (executables and submodules are covered).
  • GSTACK_VENDORED_FETCH_ROOT redirects every fetch (test setting; defense in depth only); local_prefix can point into active folders such as .github/, which PR 2's review-skip must keep in review; the default scope does not recheck unchanged entries after the base narrows its allowlist (--all does).
  • Coverage audit: 77%; gaps are CLI edges (duplicate pin across manifests, invalid base policy, --json shape, a pin-only repin, usage errors).
{
  "schema_version": 1,
  "pr": 4646,
  "head": "995e6018e54a0569a2fbeb4306ded1763dbfecf1",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1735,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 44971199367,
      "attempt": 1,
      "tree": "977e6287d8a3797fc51a467f9542508f1451e380"
    }
  ],
  "calls": 36,
  "session_kind": "unattended",
  "run": "ship-4646-r2",
  "head_tree": "b1feef152efac1ade50843e7181ae62682222a85",
  "product_patch_id": "040a4096a900ec795675e253d437e75febc4fe32",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 442,
    "rules": "85b3923b1a978e41",
    "base": "7abc1949e164e2aff49a8b06e42fb89bb473d04e",
    "registry": "7abc1949e164e2aff49a8b06e42fb89bb473d04e",
    "gate_scan": {
      "tagged": 0,
      "head": "995e6018e54a0569a2fbeb4306ded1763dbfecf1"
    },
    "reasons": [
      "gate-class",
      "risk:secret",
      "risk:security",
      "runtime=442"
    ],
    "risk": [
      "secret",
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @b1feef152efa (8 checks, current for 995e6018e54a)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/44976790164/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/44976790164/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/44976790148/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=b1feef152efa tests=38783 skipped=105 runs=44976790164/1 profiles=ci-reuse/free-tests heads=995e6018e54a verified=2026-11-22T02:42:54.381Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "blocked",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md against merge base dd611038ca41 (re-audit docs-4646-r2-a2, read-only)",
    "exception": {
      "accepted_by": "GSTA-674 lane",
      "date": "2026-11-22",
      "via": "GSTA-674 lane message to its /ship subagent, 2026-11-22 (option A)",
      "reason": "docs/ship-policy.md's review_vendored row leaves out base-named branches; the one-line fix ships in PR 2 (GST-3298)"
    }
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 4,
    "deferred": 0,
    "noted": 5,
    "fixed": 4,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 1,
    "dispatches": {
      "specialist": 3
    }
  },
  "review_round_grants": [
    {
      "kind": "fix-check",
      "head": "9e8fc0cf0b18df431fca05cd98cb8e1a80a01d94",
      "pr": 4646,
      "by": "lane GSTA-674",
      "reason": "Parent lane granted this run's one fix round in writing for the outside-voice glob blocker and native FIXABLE 1, 3 and 5",
      "at": "2026-11-22T01:11:45.937Z",
      "approval": "a-6c204277323f",
      "stop_run": "ship-4646-r2",
      "findings": [
        "p11/outside-voice#1",
        "p11/adversarial-native#1",
        "p11/adversarial-native#3",
        "p11/adversarial-native#5"
      ]
    }
  ],
  "ruled_notes": [
    {
      "finding": "lib/review-vendored.ts:204:adversarial",
      "head": "b6d4150cf1486e776f239f7e7f4b5d88ff43d435",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking",
      "at": "2026-11-22T02:15:24.504Z",
      "approval": "a-178a91105af1",
      "relayed": "GSTA-36:2026-11-22"
    },
    {
      "finding": "lib/review-vendored.ts:173:adversarial",
      "head": "b6d4150cf1486e776f239f7e7f4b5d88ff43d435",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking",
      "at": "2026-11-22T02:15:24.714Z",
      "approval": "a-bf2361775b93",
      "relayed": "GSTA-36:2026-11-22"
    },
    {
      "finding": "bin/gstack-vendored-verify:1:adversarial",
      "head": "b6d4150cf1486e776f239f7e7f4b5d88ff43d435",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking",
      "at": "2026-11-22T02:15:24.871Z",
      "approval": "a-77b6919c52f0",
      "relayed": "GSTA-36:2026-11-22"
    },
    {
      "finding": "lib/review-vendored.ts:173:outside-voice",
      "head": "b6d4150cf1486e776f239f7e7f4b5d88ff43d435",
      "by": "Captain GStack Minder (GSTA-36)",
      "reason": "fixed in fb104d7 with a failing-first regression test; fix-check 9e8fc0c..fb104d7 found 0 blocking",
      "at": "2026-11-22T02:15:25.045Z",
      "approval": "a-46065a7c1bb4",
      "relayed": "GSTA-36:2026-11-22"
    }
  ],
  "gate_dispositions": [],
  "review_targeted": {
    "classes": [
      "secret"
    ],
    "rules": "b3f6f8b4843c0c30",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "040a4096a900ec795675e253d437e75febc4fe32",
    "status": "done",
    "findings": 0,
    "raised_by": "targeted"
  },
  "carry": {
    "from": "b6d4150cf1486e776f239f7e7f4b5d88ff43d435",
    "reason": "base merge + release metadata",
    "product_patch_id": "040a4096a900ec795675e253d437e75febc4fe32",
    "changed_paths": [
      "product:.github/workflows/free-tests.yml",
      "product:.github/workflows/test-changes.yml",
      "product:.gstack/ship-policy.json",
      "product:bin/gstack-gate-diff",
      "product:bin/gstack-review-plan",
      "metadata:changelog.d/capy-keep-lands-merged-checks.md",
      "metadata:changelog.d/fix-synthetic-skill-route-fixtures.md",
      "metadata:changelog.d/main-push-reuses-land-ci-run.md",
      "metadata:changelog.d/receipt-accepts-docs-audit-after-base-merge.md",
      "metadata:changelog.d/review-scan-cap-and-hash-manifests.md",
      "metadata:changelog.d/test-changes-report.md",
      "product:crew/docs/captain.md",
      "product:crew/lib/ship-queue-gate.ts",
      "product:docs/TESTING_INTERNALS.md",
      "product:docs/pregate.md",
      "product:docs/review-policy.md",
      "product:docs/ship-policy.md",
      "product:docs/skill-routing-and-contracts.md",
      "product:docs/troubleshooting.md",
      "product:lib/gate-diff/git.ts",
      "product:lib/gh-poll.ts",
      "product:lib/land-merged-checks.ts",
      "product:lib/land-merged-ci.ts",
      "product:lib/review-collect.ts",
      "product:lib/review-exclude.ts",
      "product:lib/review-risk.ts",
      "product:lib/run-evidence.ts",
      "product:lib/ship-queue-land-direct.ts",
      "product:lib/ship-receipt-depth.ts",
      "product:lib/tool-path.ts",
      "product:scripts/ci-tree-reuse.ts",
      "product:scripts/harness-pins/scripts/test-pr-profile.ts.json",
      "product:scripts/test-changes-report.ts",
      "product:scripts/test-pr-profile.ts",
      "test:test/ci-tree-reuse.test.ts",
      "test:test/fixtures/review-pins/files/lib/review-risk.ts.json",
      "test:test/fixtures/review-pins/replays/HARN-64.json",
      "test:test/fixtures/skill-route-b1-in-sample.json",
      "test:test/fixtures/skill-route-bug-reports.json",
      "test:test/fixtures/skill-route-synthetic-prompts.json",
      "test:test/free-fixtures.test.ts",
      "test:test/gate-diff-cli.test.ts",
      "test:test/helpers/free-fixtures-data.ts",
      "test:test/land-merged-ci.test.ts",
      "test:test/review-exclude-pin-manifest.test.ts",
      "test:test/review-exclude.test.ts",
      "test:test/review-risk-hash-manifest.test.ts",
      "test:test/ship-queue-land-direct.test.ts",
      "test:test/skill-route.test.ts",
      "test:test/test-changes-report.test.ts"
    ],
    "merge_commits": 1,
    "range_diff": "1:  8a4d534 = 1:  8a4d534 Repos can prove copied open-source files match their upstream byte for byte (GST-3298)\n2:  adf85e5 = 2:  adf85e5 Regenerate doctor anchors and keep a test URL out of the credential scan\n3:  7772e2d = 3:  7772e2d Fix the vendored-verify test's git config on Windows paths and exempt its error string from the network scanner\n4:  a4143bc = 4:  a4143bc Set the executable bit through git so the vendored-verify test runs on Windows\n5:  9e8fc0c = 5:  9e8fc0c Vendored verify no longer trusts cached branches the base dropped, and catches deleted vendored files\n6:  fb104d7 = 6:  fb104d7 Vendored verify never trusts merge-queue branches, skips named branches the upstream lacks, and reports submodules as a mode problem\n7:  b6d4150 = 7:  b6d4150 Changelog entry and exit-code docs for vendored verify",
    "covers": [
      "pre-landing review",
      "adversarial review",
      "gate integrity",
      "documentation audit"
    ],
    "reruns": [
      "CI at head (gstack-ship-queue ready requires it); test and helper code changed since the reviewed head runs there unreviewed"
    ],
    "ancestry": "linear",
    "trees": [
      "977e6287d8a3797fc51a467f9542508f1451e380"
    ]
  }
}
{"head":"a4143bc5ba0cbe4a6e2bf9b83d2096283b884e2a","run":"ship-4646","status":"started","review_loop":{"passes":1,"blocking_found":3,"deferred":0,"noted":5,"fixed":0,"scope":"frozen","rounds":1,"dispatches":{"specialist":3,"red-team":1}}}
{"head":"9e8fc0cf0b18df431fca05cd98cb8e1a80a01d94","run":"ship-4646-r2","mark":"stop","tree":"32b1d5bc66e18a78feae880301b38107893033d7"}
{"head":"b6d4150cf1486e776f239f7e7f4b5d88ff43d435","version":"1.102.2.0","gstack_version":"1.102.2.0","run":"ship-4646-r2","review_loop":{"passes":1,"blocking_found":4,"deferred":0,"noted":5,"fixed":4,"scope":"frozen","fix_checks":1,"rounds":1,"dispatches":{"specialist":3}},"depth":"full"}

Open in Capy

…r byte (GST-3298)

New gstack-vendored-verify checks that every file a repo copies from an open-source
project is byte-for-byte that project's file, at a commit on its default branch or a
tag, from a repository the base branch's review_vendored policy trusts.

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 7 commits November 22, 2026 00:18
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… its error string from the network scanner

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

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…d catches deleted vendored files

Review-Finding: p11/outside-voice#1 reader=outside-voice
Review-Finding: p11/outside-voice#2 reader=outside-voice
Review-Finding: p11/outside-voice#3 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…es the upstream lacks, and reports submodules as a mode problem

A star branch glob in the base policy no longer admits a commit that only a merge-queue branch holds. A named branch the upstream doesn't have is left out of the fetch instead of failing every pin of that upstream. An upstream submodule now gives VENDORED_MODE, and --json keeps the pin count, with the pin rows under pin_results.

Review-Finding: p11/outside-voice#1 reader=outside-voice
Review-Finding: p11/adversarial-native#3 reader=adversarial-native
Review-Finding: p11/adversarial-native#1 reader=adversarial-native
Review-Finding: p11/adversarial-native#5 reader=adversarial-native
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 69ad103 into main Nov 22, 2026
62 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 22, 2026
…mes (GST-3440) (#4661)

The nightly Windows test run no longer cancels a shard at its 15-minute
limit: files without a Windows time use their Linux time instead of a
161 s guess, and the plan adds shards past eight until no shard holds
more than 12 minutes.

Why: one shard on #4646's tree held 946 s of Windows work against a 900
s job and was cancelled twice (run 44971202453); any PR adding test
files could trip it.

Nothing to do: the Windows run is nightly-only and this changes no test
selection, timeout or retry.

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