Skip to content

v1.94.37.0 feat(ci): pull requests reuse a green Free Tests run they can't control (GSTA-258 L4 plan E) - #3930

Merged
capy-ai[bot] merged 8 commits into
mainfrom
gsta258-l4-pr-ci-reuse
Nov 3, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
gsta258-l4-pr-ci-reuse

Conversation

@garrytan

@garrytan garrytan commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3930,
  "head": "97784ceff796762d0c126f78f4d3b22c8e5298b9",
  "version": "1.94.29.0",
  "base": "main",
  "session_kind": "unattended",
  "head_tree": "26df169073aaabed198b92fb53a6a8846441ba8f",
  "product_patch_id": "4fb081bbafc7484aa927961480cbaf894000cd37",
  "gstack_version": "1.94.24.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 197,
    "rules": "19881e1ecf7ed1ad",
    "base": "ade35bc81356e64c38772efa20b29021e69dcf51",
    "registry": "ade35bc81356e64c38772efa20b29021e69dcf51",
    "gate_scan": {
      "tagged": 0,
      "head": "97784ceff796762d0c126f78f4d3b22c8e5298b9"
    },
    "reasons": [
      "gate-class",
      "runtime=197"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @26df169073aa (7 checks, current for 97784ceff796)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/41682873686/attempts/1",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41682873686/attempts/1",
    "free-tests.yml/cso-windows-launcher: https://github.com/garrytan/gstack/actions/runs/41682873686/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=26df169073aa tests=34994 skipped=70 runs=41682873686/1 profiles=ci-reuse/free-tests heads=97784ceff796 verified=2026-11-03T17:25:39.782Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "blocked",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md (read-only, c197a139..567cc967)",
    "exception": {
      "accepted_by": "GSTA-258 (2026-11-03)",
      "date": "2026-11-03",
      "via": "GSTA-258 message to L4 (Subagent 13), same call as #3904, #3920 and #3923",
      "reason": "re-audit launch failed on a missing candidate; both stale statements from audit 1 fixed in 81d54d39 and 567cc967"
    }
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 3,
    "deferred": 0,
    "noted": 1,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 1,
    "rounds": 3,
    "ledgers_read": 3,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  },
  "review_loop_exception": {
    "accepted_by": "GStack Minder",
    "date": "2026-11-03",
    "via": "GSTA-36's call relayed by GSTA-258, 2026-11-03 (approval a-8bf00b828253)",
    "reason": "third, last exception on #3930: the one-line head_branch dedupe in ApiRun at 97784cef (rule 19 merge of main ade35bc8, keeping #3934's copy); one clean Opus scoped reader confirmed only that field moved, no further rounds",
    "fix_check": {
      "head": "97784ceff796762d0c126f78f4d3b22c8e5298b9",
      "findings": 0,
      "files": [
        "lib/run-evidence.ts"
      ]
    }
  }
}

What changed

  • Pull request runs of Free Tests can reuse a green run (scripts/ci-tree-reuse.ts find --pull-request, findPrReuse). A source is a green push or workflow_dispatch run on main, or a workflow_dispatch run on the pull request's own branch. It counts only when its tested tree is GitHub's merge commit's tree and the merge commit leaves .github/workflows/free-tests.yml, scripts/ci-tree-reuse.ts and lib/run-evidence.ts byte-identical to its main parent. A pull_request run is never a source.
  • free-tests.yml: the reuse job also runs on pull_request and passes --pull-request. The aggregate's route step accepts a reuse on pull_request runs of refs/pull/<n>/merge as well as main pushes. windows-free-tests.yml is unchanged.
  • The reuse code is main's. On a pull request the reuse job checks out the base commit (github.event.pull_request.base.sha), never the merge commit, and runs bun with --no-env-file --config=/dev/null. The script, everything it imports and .gstack/pregate.json are main's bytes.
  • Sizing experiments are never evidence. A dispatch that overrides free_runner, free_shards or free_jobs records sizing_experiment: true in tested-tree, and verifyRun refuses it for every consumer (PR reuse, main-push reuse, CI-carry, --from-run).
  • A re-run never reuses (rerun), so a red earlier attempt of the same pull request run can't be hidden.
  • lib/run-evidence.ts: verifyRun takes ignoreRun, so the pull request's own in-progress run doesn't veto a branch dispatch at the same head. ApiRun gains the optional head_branch.
  • Tests: test/ci-tree-reuse.test.ts adds failing-first cases. Reuse is accepted from a main push and from a same-branch dispatch. It's refused when the workflow changed, when the reuse script or run verifier changed, on a tree mismatch, when the only source is a pull_request run, for a push or dispatch on another branch, for a fork head and for a malformed merge commit. test/ci-reuse-workflow-wiring.test.ts changes only to state the narrower property, and the route step now passes a pull_request reuse on free-tests.yml and still fails one on windows-free-tests.yml.

Why

Plan E in plans/ship-90-90.md: a lane dispatches Free Tests on its branch for CI-carry, and the pull_request run at the same tree then runs the whole suite again. Today only a push to main consumes, because a pull request mustn't certify itself (GST-1190's bootstrap rule: head policy never certifies itself). This keeps that rule. Every source is a run the pull request can't change, and the rules that decide the reuse (the workflow, the reuse script and the verifier) must be main's bytes.

Security call-out (R45)

This edits a required workflow, .github/workflows/free-tests.yml. The reuse job now runs on pull_request with the job-level actions: read it already had for main pushes; every other job keeps contents: read. It reads this repository's runs, commits and file blobs through the GitHub API with GITHUB_TOKEN (gh api), and downloads a source run's tested-tree artifact as before. No secrets, no pull_request_target, no new dependency, and no install or setup change. A fork pull request is refused before any read. A pull request that edits the workflow, the reuse script or lib/run-evidence.ts never reuses, so it can't change what reuse accepts in its own run. That guard trusts the workflow file itself. A pull request that rewrites the workflow's find step could fake its outputs and skip the suite, just as any workflow edit could skip jobs before this change, so a change to .github/workflows/ still needs a person's review.

Pre-Landing Review

REVIEW_LOOP: passes=2 blocking_found=3 deferred=0 noted=1 fixed=3 scope=frozen ledgers_read=3 fix_checks=1 dispatches=4

Pass 1 (gate class, full) raised three findings, each one a way to turn the required check green without a valid run. I raised them to CRITICAL and fixed them in 284bd91 with failing-first tests. The PR run executed its own copy of the reuse code, a sizing-experiment dispatch could be the source, and a re-run hid its own red earlier attempt. Pass 2 and Step 11's adversarial and outside voices found only the notes below. docs/pregate.md counts as a behavior input, so its docs-audit edits sent finish back to Step 9. The review plan at 567cc96 said done (round cap reached, below-floor fixes ship as notes), so no reader ran again.

Review-loop exception: accepted by GStack Minder 2026-11-03 via GSTA-36's call relayed by GSTA-258, 2026-11-03 (approval a-daba080eb8aa): L4's clean Opus reader of the 83-line resolution at 73f1fd6 (the lib/run-evidence.ts and docs/pregate.md union hunks) counts as #3930's second exception, no further rounds (fix-check at 73f1fd6, 0 findings)

Review-loop exception: accepted by GStack Minder 2026-11-03 via GSTA-36's call relayed by GSTA-258, 2026-11-03 (approval a-8bf00b828253): third, last exception on #3930: the one-line head_branch dedupe in ApiRun at 97784ce (rule 19 merge of main ade35bc, keeping #3934's copy); one clean Opus scoped reader confirmed only that field moved, no further rounds (fix-check at 97784ce, 0 findings)

Base merges (rule 19)

Open review notes (below the blocking floor, not fixed)

  • Sizing records from before this change stay acceptable for up to 24 hours. A sizing-experiment dispatch recorded before this PR merges has no sizing_experiment field, so verifyRun accepts it until max_age_hours (24) expires it. Don't use a sizing dispatch from that window as evidence.
  • windows-free-tests.yml's record step has no sizing marker. A Windows dispatch with windows_jobs set still uploads an accepted tested-tree. Windows Free Tests is nightly and manual and never a PR obligation; the fix is SIZING_OVERRIDE: ${{ inputs.windows_jobs }} in a follow-up.
  • base.sha can lag the merge commit's main parent. The reuse job runs main's code from pull_request.base.sha, and the guard compares against the merge commit's first parent. While main moves under an open PR, a newer tightening of the reuse code wouldn't apply to that PR until its next push. The code that runs is still main's.

Documentation

Documentation exception: accepted by GSTA-258 (2026-11-03) 2026-11-03 via GSTA-258 message to L4 (Subagent 13), same call as #3904, #3920 and #3923: re-audit launch failed on a missing candidate; both stale statements from audit 1 fixed in 81d54d3 and 567cc96

Audit 1 (read-only) found two stale statements in docs/pregate.md: the reuse job "runs only on a push to main", and "only a push to main reuses". Both are fixed, in 81d54d3 and 567cc96. The re-audit launch failed on a missing candidate file, which spent the audit budget. No known doc gap remains.

Sibling merges (rule 25)

Trial merges at 97784ce against trains 105 and 106 (#3920, #3947, #3958, #3933, #3917, #3937, #3955, #3926 and #3931) are clean, and bun run typecheck exits 0 on each merged tree. #3957 conflicts in test/fixtures/skill-md-size-allowlist.json, a file this PR doesn't touch; #3957 conflicts with main ade35bc the same way.

Blast radius

Free Tests on pull requests. A refusal or any lookup failure runs every job exactly as before. A reused pull request run uploads no tested-tree, so CI-carry and the post-merge main push read the source run directly or run in full.

Refs GST-1136 (plan E follow-up to #3926). Independent of #3926: the two PRs share no file.

Approvals

Approved: yes (record r-e6470791e898). The full approval record stays private: this repository is public or its visibility is unknown.

Open in Capy

…ol (GSTA-258 L4, plan E)

A pull_request run of free-tests.yml reuses a green push or dispatch run on main, or a dispatch run on its own branch, at the merge commit's exact tree, only when the merge commit leaves the workflow, scripts/ci-tree-reuse.ts and lib/run-evidence.ts byte-identical to main. A pull_request run is never a source. Opt-in per workflow with find --pull-request; windows-free-tests.yml is unchanged.

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

trunk-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 4 commits November 3, 2026 07:50
…experiments are never evidence; a re-run never reuses)

Review-Finding: p1/specialist-batched#1 reader=security
Review-Finding: p1/red-team#1 reader=red-team
Review-Finding: p1/red-team#2 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>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
docs/pregate.md keeps the ci-reuse-pr subsection and main's Owner-granted flaky
exception section (#3911), in that order.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
garrytan and others added 3 commits November 3, 2026 14:36
lib/run-evidence.ts keeps #3929's skipped_files, job_skipped, skipped and
skipped_jobs evidence and its verifyRun unchanged option next to #3930's
sizing_experiment field and refusal and the ignoreRun option.
docs/pregate.md run_profiles row keeps #3930's wording and adds skippable?.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
lib/run-evidence.ts: #3934 (7caca33) adds head_branch to ApiRun on the
repository line; drop this branch's copy on the first line so the type has
one definition.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title feat(ci): pull requests reuse a green Free Tests run they can't control (GSTA-258 L4 plan E) v1.94.37.0 feat(ci): pull requests reuse a green Free Tests run they can't control (GSTA-258 L4 plan E) Nov 3, 2026
@capy-ai
capy-ai Bot merged commit 4f1d2ad into main Nov 3, 2026
49 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