Skip to content

v1.92.39.0 ci: main pushes reuse the merged PR's verified run of the same tree; dispatch-ci and --from-run go through the run verifier (GSTA-156 P3b) - #3709

Merged
capy-ai[bot] merged 8 commits into
mainfrom
capy/gsta156-ci-reuse
Nov 1, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
capy/gsta156-ci-reuse

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3709,
  "head": "ffa2edc3c306be8bd8b28ac0cd38a7e39ad34f75",
  "version": "1.91.377.0",
  "base": "main",
  "gate": {
    "pregate.json/remote_gate": {
      "pass": 8993,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "4cd42ba1be79dccdc1cf5d18d7f63d91f24e6893",
  "product_patch_id": "9c7b78e839b9fec105fef481ef6443745e696e28",
  "gstack_version": "1.91.378.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 620,
    "rules": "150435b0a543019a",
    "base": "4f5b043b3ea02f4fa9887c0122452856c045bb82",
    "registry": "4f5b043b3ea02f4fa9887c0122452856c045bb82",
    "gate_scan": {
      "tagged": 2,
      "head": "ffa2edc3c306be8bd8b28ac0cd38a7e39ad34f75"
    },
    "reasons": [
      "gate-class",
      "runtime=620>50"
    ]
  },
  "pregate": "requires-remote cleared @4cd42ba1be79 (7 checks, current for ffa2edc3c306)",
  "requires_remote": [
    "free-tests.yml/cso-macos-launcher: https://github.com/garrytan/gstack/actions/runs/41327637127",
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41327637127",
    "free-tests.yml/cso-windows-launcher: https://github.com/garrytan/gstack/actions/runs/41327637127",
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41327637069",
    "pregate.json/remote_gate: remote-gate tree=4cd42ba1be79 tests=9311"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "capy/gsta156-ci-reuse c830c9b8..e4997003 (21 files; audit p3b-docs-1; its two docs/pregate.md fixes committed in ceeab442a)"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 1,
    "deferred": 0,
    "noted": 4,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 2,
    "dispatches": {
      "specialist": 3,
      "red-team": 1
    }
  },
  "carry": {
    "from": "ceeab442ae8521bc3da4a80658b0878479488c73",
    "reason": "base merge + base context moved (scoped review by anthropic/claude-opus-5-5: lib/pregate/checks/lanes.ts) + release metadata",
    "product_patch_id": "9c7b78e839b9fec105fef481ef6443745e696e28",
    "changed_paths": [
      "product:.github/docker/Dockerfile.ci",
      "product:.github/scripts/history-read.sh",
      "product:.github/workflows/evals-main-backstop.yml",
      "product:.github/workflows/evals.yml",
      "product:.github/workflows/free-tests.yml",
      "product:.github/workflows/version-gate.yml",
      "product:.gitignore",
      "product:.gstack/ship-policy.json",
      "metadata:CHANGELOG.md",
      "product:CLAUDE.md",
      "product:CONTRIBUTING.md",
      "product:README.md",
      "product:TODOS.md",
      "metadata:VERSION",
      "metadata:agents-digest/gstack-AGENTS.md",
      "product:autoplan/SKILL.md.tmpl",
      "product:bin/dev-setup",
      "product:bin/gstack-capy-install",
      "product:bin/gstack-config",
      "product:bin/gstack-docs-candidate",
      "product:bin/gstack-doctor-components.sh",
      "product:bin/gstack-eval-plan",
      "product:bin/gstack-ff-update",
      "product:bin/gstack-global-discover.ts",
      "product:bin/gstack-harness",
      "product:bin/gstack-harness-ledger.sh",
      "product:bin/gstack-host-renders.sh",
      "product:bin/gstack-install-registry.sh",
      "product:bin/gstack-office-hours-review",
      "product:bin/gstack-plan-reality",
      "product:bin/gstack-redact-prepush",
      "product:bin/gstack-repo-mode",
      "product:bin/gstack-retro-metrics",
      "product:bin/gstack-review-dispatch",
      "product:bin/gstack-review-log",
      "product:bin/gstack-review-plan",
      "product:bin/gstack-review-read",
      "product:bin/gstack-session-update",
      "product:bin/gstack-ship-budget",
      "product:bin/gstack-ship-parts",
      "product:bin/gstack-ship-queue",
      "product:bin/gstack-ship-receipt",
      "product:bin/gstack-skill-start",
      "product:bin/gstack-slug",
      "product:bin/gstack-tasks",
      "product:bin/gstack-team-init",
      "product:bin/gstack-uninstall",
      "product:bin/gstack-upgrade",
      "product:browse/bin/remote-slug",
      "test:browse/test/cookie-import-native.test.ts"
    ],
    "merge_commits": 1,
    "range_diff": "1:  dd5037591 = 1:  dd5037591 feat(pregate): gstack run profiles, dispatch-ci clears through the run verifier, --from-run tests stage (GSTA-156 P3b)\n2:  b89828b4d = 2:  b89828b4d ci(free-tests): main pushes reuse the merged pull request's verified run of the same tree (GSTA-156 P3b)\n3:  76d071637 = 3:  76d071637 test(cso): the free-tests aggregate still requires cso-docker-integration on its strict path, and only a verified reuse skips it (GSTA-156 P3b)\n4:  268f0ab2c = 4:  268f0ab2c fix(pregate): name the reuse profiles after no lane, so lane clears and ready --dispatch-ci keep the URL path until GST-555 (GSTA-156 P3b)\n5:  e49970033 = 5:  e49970033 fix(ci): the duration recorder grants actions: read to its windows-free-tests call, and --from-run refuses a run that recorded zero tests (GSTA-156 P3b)\n6:  ceeab442a = 6:  ceeab442a docs: pregate run_profiles row, no_verified_run code; changelog for caller grant and zero-test refusal",
    "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": [
      "113a4412d3b8801e3694a9cc79ae66885929796c"
    ]
  }
}

What changed

A push to main no longer reruns Free Tests and Windows Free Tests on a tree its pull request already passed. On a main push, a new reuse job finds the merged pull request, requires its head's tree to equal the pushed tree, and verifies that head's newest green pull_request or workflow_dispatch run with the same checks gstack-pregate clear --run uses. When the run verifies, every suite job is skipped and the required check links the reused run. Anything else, a failed or skipped reuse job included, runs every job exactly as before.

  • Both aggregates upload a tested-tree record (tree.json) only after strict verification passes. Reused runs never upload one, so a reused run is never reused.
  • gstack-pregate --stage tests --from-run <run> counts the selected local test files a verified Free Tests run on this exact tree already ran, and runs the rest.
  • .gstack/pregate.json declares two run profiles, ci-reuse/free-tests and ci-reuse/windows-free-tests. Neither is named after a lane, so macOS and Windows lane clears and gstack-ship-queue ready --dispatch-ci keep recording the run URL exactly as today.
  • lib/ship-queue-dispatch-ci.ts is unchanged from main. This branch first routed dispatch-ci clears through the verifier, but that path would still refuse a lane when the base config or origin couldn't be read, which changes behavior for pull requests already in flight. I reverted it to main and dropped its test. Lane profiles and dispatch-ci verification wait until open pull requests carry the tested-tree producer. Follow-up: GST-555
  • A run whose tree.json lists no files or zero tests never counts (no_tests).

Why

22 of 22 merges in 30 hours (Oct 27–29) reran both suites on the identical tree, about 66 Linux shard-minutes and 44 Windows minutes per merge. The pull request run already proved that exact tree.

Before and after: main pushes rerun both suites vs. reuse the verified pull request run

Workflow and permission changes

Every change under .github/workflows, and why it's needed:

  • free-tests.yml and windows-free-tests.yml: new reuse job with permissions: { contents: read, actions: read }. It runs on main pushes only. actions: read lets it list this repository's workflow runs and download their tested-tree artifacts. It's the only job in either workflow with that grant, and the workflow-level permission stays contents: read. Every suite job gains needs: reuse and an if: that runs it unless reuse verified a run. The aggregates pick the reuse or strict path in their first step, and the strict path is unchanged.
  • free-durations-record.yml: the windows: job (uses: ./.github/workflows/windows-free-tests.yml) now grants contents: read and actions: read. A called workflow can't hold more than its caller grants, and the called workflow's new reuse job asks for actions: read. Without this grant GitHub rejects the scheduled duration run before it starts. Nothing else in that file changed. A new test fails if any caller of either workflow drops the grant.
  • Token use in scripts/ci-tree-reuse.ts. The reuse step passes GH_TOKEN: ${{ github.token }} to the gh CLI, which makes read-only gh api GET calls on this repository's own pull requests, runs and artifacts (at most 10 pull requests and 10 candidate runs). It never writes, never reads another repository, and checkout uses persist-credentials: false.

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-29 Approve the plan "Run each full suite once per tree; stop finished /ship subagents; scan only new patches in sealed (GSTA-156, v2)" (autoplan run autoplan-20261029033528, 8 decisions) “Garry: Do it” (Garry (via GStack Minder), relayed by agent:gstack-minder) approved the reviewed plan (sha256 3790c7eb1630), every recommendation taken none
2026-10-29 Approve the plan "Run each full suite once per tree; stop finished /ship subagents; scan only new patches in sealed (GSTA-156, v2)" (autoplan run autoplan-20261029033528, 1 decisions) “Garry: Do it” (Garry (via GStack Minder), relayed by agent:gstack-minder) approved the reviewed plan (sha256 3790c7eb1630), every recommendation taken none
2026-10-31 #3709 review: red team found lane-named run profiles would block in-flight PRs' macOS/Windows lane clears; (a) split the reuse profiles from lane names, drop lane profiles, keep dispatch-ci on the URL path, follow-up GST-555 “Do it” (GStack Minder (Captain), relayed by the GSTA-156 lane) approved #3709 profile split and dispatch-ci revert; lane profiles and dispatch-ci verification move to GST-555 none
2026-10-31 #3709 adversarial review: the new reuse job asks for actions: read, but free-durations-record.yml's windows: caller grants none, so the scheduled run fails at startup. Commit the caller grant with its tests and the tests:0 refusal “Do it. Commit the three-line free-durations-record.yml change” (Garry (via GStack Minder)) approved the windows: job permissions in free-durations-record.yml only, its pinning tests, and the no_tests refusal none

Source: gstack-approvals record for capy/gsta156-ci-reuse (display only; not an approval citation).

Summary

Every merge to main ran both free suites twice, once on the pull request and again on the push of the same tree. This makes the main push reuse the pull request's verified run when the trees match, and fall back to the full run on any doubt. The same verifier lets gstack-pregate --from-run skip local files a verified run already passed.

Blast radius

The change touches the two required free-suite workflows, the duration recorder that calls the Windows one, and pregate's tests stage. Pull request and dispatch runs never take the reuse path, and a skipped or failed reuse job runs every job as before. Evidence: test/ci-reuse-workflow-wiring.test.ts evaluates each suite job's condition for a skipped, failed and successful reuse, and both workflows ran green at ceeab44 on this pull request with reuse skipped.

Test Coverage

All new code paths have test coverage: test/ci-tree-reuse.test.ts, test/ci-reuse-workflow-wiring.test.ts, test/pregate-from-run.test.ts, test/run-evidence.test.ts, test/free-durations-record-workflow.test.ts and test/cso-distribution.test.ts.

  • Fails on the old code: test/pregate-from-run.test.ts, the zero-test case in test/run-evidence.test.ts, and the caller-grant check in test/ci-reuse-workflow-wiring.test.ts.
  • Tests ran: pregate.json/remote_gate 8993

Pre-Landing Review

The red team found one blocking issue. Lane-named run profiles would have blocked macOS and Windows lane clears for pull requests already in flight. It was fixed by naming the reuse profiles after no lane and leaving ready --dispatch-ci unchanged (GST-555). The outside voice found that a run recording zero tests could count as evidence, so verifyFromRun now refuses it (no_tests). The adversarial pass found that the duration recorder's Windows caller didn't grant actions: read, so the scheduled run would fail at startup. That's fixed with the caller grant above. Both fix-checks found no new issues.

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

Gate edits: 29 listed, 13 read, 0 findings — 0 kept, 0 restored, 0 open

Outside review: completed (openai/gpt-6.1-sol); its one blocking finding is fixed.

Review notes

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

  • scripts/lib/ci-history.ts:293 (adversarial, filed as test:health flake rate counts reused main pushes that ran no shards (after #3709) #3725): test:health counts every green main Free Tests run in the flake-rate window. A reused main push runs no shards, so as reuse takes over, the 20-run window holds fewer runs that actually tested anything and real flake rates read lower. lib/factory-scorecard.ts has the same gap. Related: test:health flake rate counts reused main pushes that ran no shards (after #3709) #3725
  • lib/pregate/checks/lanes.ts:525: --from-run without --allow-repo-commands reports REPO_COMMANDS_NOT_ALLOWED even when every selected file passed in the run. It fails closed, and the crew's remote pregate always passes the flag.
  • lib/pregate/checks/lanes.ts:542: --from-run matches only profiles that hold a local non-platform lane, so on a Mac it does nothing today.
  • .github/workflows/free-tests.yml:734: Free Tests' tree.json lists Linux, macOS and Windows while files holds only the Linux plan. Nothing reads it that way until GST-555 adds a macOS or Windows profile on this workflow.
  • scripts/ci-tree-reuse.ts:46: fail-safe refusals (the commit-to-PR lookup lagging right after a squash merge, the 24-hour age limit, two tested-tree artifacts after a rerun) will put the reuse hit rate below 22 of 22.

Exploratory QA

No user-facing surface changed; the workflow behavior is covered by the wiring tests above.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Plan Completion

The plan from autoplan-20261029033528 is done, with one item moved out. Lane-named run profiles and dispatch-ci verification go to GST-555, as the Captain decided.

Issues

Related: #3725

Documentation

Status: updated. Two factual corrections to docs/pregate.md. No blockers.

Scope: branch capy/gsta156-ci-reuse, base c830c9b8 to head e4997003 (5 commits, 21 files). The candidate selected only committed changes, and nothing was staged, unstaged or untracked. The candidate lists 140 docs, and I checked all of them for terms the diff touches (run profiles, clear --run, tested-tree, ci-tree-reuse, --from-run, dispatch-ci, free-durations-record, pull_request runs). I read docs/pregate.md in full, the matching sections of docs/ship-policy.md, docs/troubleshooting.md and docs/TESTING_INTERNALS.md, and the changelog fragment. I checked each claim against scripts/ci-tree-reuse.ts, lib/run-evidence.ts, lib/pregate/checks/lanes.ts, lib/pregate/run-check.ts, bin/gstack-pregate and both workflow diffs. Banned terms: none (the repo keeps no list).

Documentation health:

  • docs/pregate.md: Updated. The run_profiles row in the pregate-v1 key table now says --from-run and the main-push reuse job also verify runs against these profiles, with links to #from-run and #ci-reuse. The --from-run refusal codes now include no_verified_run, which verifyFromRun returns when more than one profile applied and each refused. The new #from-run and #ci-reuse sections already match the code: the 10-PR and 10-run limits, the reason codes, the job permissions, the route step and the producer fields.
  • docs/ship-policy.md: Current. The --dispatch-ci URL recording is still accurate (GST-555 follow-up). The line saying slot checks run live "until GSTA-156's exact-tree reuse is on main" still holds, because this branch reuses runs only on main pushes and train-build reuse is a later GSTA-156 step.
  • docs/troubleshooting.md: Current. PREGATE_RECEIPT_INVALID and PREGATE_CONFIG_INVALID still describe clear --run and run_profiles correctly. A --from-run refusal is not an error code, because it runs every test.
  • docs/TESTING_INTERNALS.md: Current. The free-suite shard, aggregate and duration-recorder descriptions still hold for every run that executes the suite.
  • changelog.d/capy-gsta156-ci-reuse.md: Current (not edited: CHANGELOG is owned by the parent). Its claims match the diff.
  • README.md, CLAUDE.md, AGENTS.md, CONTRIBUTING.md: Current. None of them describes this surface.

Coverage debt:

  • gstack-pregate --from-run: reference in docs/pregate.md#from-run and in --help; no how-to (common gap).
  • Main-push CI reuse (scripts/ci-tree-reuse.ts, the reuse jobs, the tested-tree artifact): reference and explanation in docs/pregate.md#ci-reuse; no troubleshooting entry for reading a REUSE: refused step summary on main (common gap).
  • ci-reuse/free-tests and ci-reuse/windows-free-tests profiles: reference only (common gap).
  • docs/TESTING_INTERNALS.md never mentions that a reused main push skips the shards, the flake-ledger summary and the strict verification. It has no link to #ci-reuse (common gap; nothing it says is wrong).

Diagram drift: none. No diagram names an entity this diff changed.

Test plan

  • UBI_OWNER=gsta156 gstack-pregate --allow-repo-commands --remote --spend-cap 2 --timeout 2700 at ceeab44: 8993 tests, 0 failed on tree 113a4412d3b8, $0.07, VM destroyed
  • Free Tests run 41231312884 and Windows Free Tests run 41231312907 at ceeab44 cleared the macOS and Windows lanes; gstack-pregate verify ok
  • actionlint 1.7.11 clean on free-tests.yml, windows-free-tests.yml and free-durations-record.yml
  • Typecheck clean

Changelog: changelog.d/capy-gsta156-ci-reuse.md.

Open in Capy

garrytan and others added 2 commits October 31, 2026 17:58
…n verifier, --from-run tests stage (GSTA-156 P3b)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…run of the same tree (GSTA-156 P3b)

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

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 3 commits October 31, 2026 18:14
…tion on its strict path, and only a verified reuse skips it (GSTA-156 P3b)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…nd ready --dispatch-ci keep the URL path until GST-555 (GSTA-156 P3b)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ee-tests call, and --from-run refuses a run that recorded zero tests (GSTA-156 P3b)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…aller grant and zero-test refusal

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@capy-ai
capy-ai Bot marked this pull request as ready for review October 31, 2026 19:50
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	lib/pregate/checks/lanes.ts
@github-actions github-actions Bot changed the title ci: main pushes reuse the merged PR's verified run of the same tree; dispatch-ci and --from-run go through the run verifier (GSTA-156 P3b) v1.92.39.0 ci: main pushes reuse the merged PR's verified run of the same tree; dispatch-ci and --from-run go through the run verifier (GSTA-156 P3b) Nov 1, 2026
@capy-ai
capy-ai Bot merged commit 77fe28c into main Nov 1, 2026
78 checks passed
capy-ai Bot added a commit that referenced this pull request Nov 2, 2026
…ee-suite flake counts (#3725) (#3822)

A main push that reused its merged PR's verified run (#3709) runs no shards and uploads nothing, so both readers counted it as a zero-flake run and diluted real flake rates under the 5% bar. reuseChecker (scripts/lib/ci-history.ts) marks a run with no artifacts and a green reuse job; readCiFlakeLedgers leaves it out and refills the window, readFreeRetries leaves it out of the free-retry count. One capped job listing per artifact-less run (40 per read); past the cap or on a failed listing the run counts as before, with a note.

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