Skip to content

v1.92.62.0 fix(pregate): clear --run-url refuses a run of another workflow - #3832

Merged
capy-ai[bot] merged 8 commits into
mainfrom
gsta203-pr6-clear-workflow-check
Nov 2, 2026
Merged

capy-ai[bot] merged 8 commits into
mainfrom
gsta203-pr6-clear-workflow-check

Conversation

@garrytan

@garrytan garrytan commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3832,
  "head": "2b3a7981cd63e2292522b2fbd7600684c5329a45",
  "version": "1.92.51.0",
  "base": "main",
  "gate": {
    "focused": {
      "pass": 54,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "3c908c18e2b5b000362541be9e8d126dff947b9b",
  "product_patch_id": "fac5c9f9e82d492cb75167774f51f99d5d231cc0",
  "gstack_version": "1.92.51.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 40,
    "rules": "97c1e5fe49607f73",
    "base": "a563f476793b61edbb064b853d52cb125a1996c4",
    "registry": "a563f476793b61edbb064b853d52cb125a1996c4",
    "gate_scan": {
      "tagged": 0,
      "head": "2b3a7981cd63e2292522b2fbd7600684c5329a45"
    },
    "reasons": [
      "gate-class",
      "runtime=40"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @3c908c18e2b5 (7 checks, current for 2b3a7981cd63)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/41381957170",
    "pregate.json/remote_gate: remote-gate tree=3c908c18e2b5 tests=10218 receipt=/home/user/.gstack/projects/garrytan-gstack/pregate/runs/20261102T025742Z-622483-4872/remote/remote.log sha256=976f437feeda"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ (131 files) plus TODOS.md and the changelog fragment, candidate a563f47..2b3a798"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 3,
    "fixed": 1,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 4,
    "dispatches": {
      "specialist": 2,
      "red-team": 2
    }
  }
}

What changed

A run of another workflow no longer clears a lane with no run profile

A run of another workflow no longer clears a lane with no run profile.

Before/after as text: A run of another workflow no longer clears a lane with no run profile
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 $ gstack-pregate clear --remote a.yml/job --run-url https://github.com/fx/fx/actions/runs/300
   (run 300 ran .github/workflows/b.yml; the lane has no run profile)
 
+PREGATE_RECEIPT_INVALID: REUSE: refused reason=workflow_mismatch — run 300 attempt 1 ran
+  .github/workflows/b.yml, not .github/workflows/a.yml; a.yml/job stays uncleared
+fix: clear a.yml/job with a run of its own workflow: gh workflow run a.yml --ref <branch>,
+  then gstack-pregate clear --remote a.yml/job --run-url <that run's URL>
+
+A run of a.yml still clears (receipt = the URL). On main's own workflows the Windows
+obligation is windows-smoke.yml/windows-smoke; a windows-free-tests.yml run is refused.
+# branch 2b3a798: test/pregate-clear-runs.test.ts 14 pass, 0 fail
-# main a563f47: test/pregate-clear-runs.test.ts -t GSTA-203
-Expected: "PREGATE_RECEIPT_INVALID: REUSE: refused reason=workflow_mismatch — run 300 attempt 1 ran
-           .github/workflows/b.yml, not .github/workflows/a.yml; a.yml/job stays uncleared"
-Received: "cleared https://github.com/fx/fx/actions/runs/300"
-(fail) 0 pass, 1 fail
 

Live on this PR's own runs: main's gstack-pregate clear --remote free-tests.yml/macos-named-regressions --run-url <windows-smoke.yml run 41381957103> printed PREGATE_CLEARED; this branch's bin/gstack-pregate refuses it with workflow_mismatch and the fix line, and clears the lane from the Free Tests run 41381957170 (also from its /job/1?pr=3832 link).

Why

"A run of a different workflow clears an obligation it never tested." Branches cut before #3806 still owe windows-free-tests.yml/windows-free-shard, and lanes were clearing it with windows-smoke.yml run URLs, because clear --run-url on a lane with no run profile recorded any URL. Now clear reads the run and refuses unless its workflow file is the lane's own.

Blast radius

Only gstack-pregate clear --run-url on a platform lane with no run profile, when the base config and the GitHub origin can be read; test_backend/*, --bundle-lane, pregate.json/remote_gate, profiled lanes and non-GitHub origins take the same paths as before (lib/pregate/index.ts clearDecision, read and asserted in test/pregate-clear-runs.test.ts). ready --dispatch-ci never calls clearDecision: it already matches each lane to the dispatched workflow (lib/ship-queue-dispatch-ci.ts:81, read). A signed-out gh now refuses that clear (api_error) instead of recording it. The ready conflict hint (lib/ship-queue.ts) changes text only.

Behavior changes

  • gstack-pregate clear --run-url on a lane with no run profile: before, any URL was recorded; now a run of another workflow (workflow_mismatch), a run gh cannot read (api_error) or a URL that is not an Actions run on this repository (run_ref_invalid) refuses PREGATE_RECEIPT_INVALID, each with its own fix line.
  • gstack-ship-queue ready conflict ci-hint:: now says to clear each lane pregate names with a run of that lane's own workflow.

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-11-02 Approve the plan "GSTA-203 PR 6: pregate clear refuses wrong-workflow run URLs" (autoplan run autoplan-20261102021943, 3 decisions) “Plan: run a one-round, eng-only plan (CREW fix-lane rule), record it in the trail, then build. No ELI5 gate is needed; I have the Captain's order.” (GStack Minder (Captain order), relayed by agent:jam_01M69CB3BQ3QV1MTTJSM7J08F1) approved the reviewed plan (sha256 f76371795c33), every recommendation taken none
2026-11-02 Grant one scoped fix-check after review round 2 for the ?pr=/#step strip “GStack Minder has granted the round-2 fix under rule 23, with these conditions.” (GStack Minder) approved commit the strip and its failing-first test, one scoped fix-check on that hunk, no third round; plus the windows-smoke discovery test, docs and the ready hint none
2026-10-16 Merge on green “yes merge when green” (Garry (CREW rule 6, standing)) standing approval GStack Minder merges through a train; lanes never merge none

Source: gstack-approvals record for gsta203-pr6-clear-workflow-check (display only; not an approval citation).

Summary

Lanes cut before #3806 were clearing the old Windows lane with windows-smoke runs, and pregate let them because it never opened the run. clear now reads the run's workflow file, refuses a mismatch with a fix that names the right workflow, and still accepts the right run, including a job link copied from the checks page. A test on this repository's own workflows pins main's Windows obligation to windows-smoke.yml/windows-smoke (the six-shard job is manual), and the ready hint now points each lane at its own workflow.

The ci-reuse/windows-free-tests run profile is unchanged, because no lane id matches it, its reuse job runs only on push to main (which windows-free-tests.yml no longer triggers on), and --from-run accepts only a verified green run of the exact tree.

Test Coverage

All new code paths have test coverage. Each regression test failed before its fix: the wrong-workflow test at 51efe02 on main's code (0 pass, 1 fail; received cleared https://github.com/fx/fx/actions/runs/300), the copied-link test at a330d4d (0 pass, 1 fail).

Tests ran: focused 54

Pre-Landing Review

No blocking issues. One informational finding was fixed in pass 1 (each refusal names its own fix). The round-2 ?pr=/#step strip was fixed under GStack Minder's rule 23 grant, with one scoped fix-check. Then a scoped fix-check on Captain-ordered hunks, same grant (trail row 13): the ready hint, the windows-smoke discovery test and the docs/pregate.md wording. Both fix-checks were clean apart from informational notes.

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

Gate edits: none detected (GATE_SCAN tagged=0)

Outside review: gpt-6.1-sol, clean.

Review notes

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

  • INFORMATIONAL lib/pregate/index.ts:263 run_ref_invalid refuses job links with ?pr= or #step anchors because parseRunRef ends with /?$; the fix line names the accepted form, so it costs one retry.
  • INFORMATIONAL lib/pregate/index.ts:263 run URLs with ?pr= or #step suffixes refuse run_ref_invalid (parseRunRef ends /?$); loud, fix line names the accepted form
  • INFORMATIONAL lib/pregate/index.ts:268 a failed, cancelled or old run of the right workflow still clears a no-profile lane; documented, run profiles add the rest
  • INFORMATIONAL bin/gstack-pregate:237 non-github.com origin skips the check with a warning (unchanged, documented)
  • INFORMATIONAL lib/ship-queue.ts:178 conflict ci-hint says dispatch windows-smoke.yml; on a pre-v1.92.51.0 ci: windows-smoke is the required Windows check; the six-shard suite runs nightly (GSTA-203 PR 1) #3806 branch clearing the old lane with that run now refuses workflow_mismatch (refusal fix names the right workflow; TODOS tracks the hint)
  • INFORMATIONAL lib/run-evidence.ts:135 (fix-check): profiled lanes and --run still refuse ?pr= job links through verifyRun; unchanged and fails closed.
  • INFORMATIONAL docs/pregate.md:782 (fix-check): main also has free-tests.yml/cso-windows-launcher and windows-setup-e2e.yml/windows-setup as Windows lanes, so "the Windows obligation" means the free tier's smoke lane.

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Plan Completion

Plan: eng-only autoplan run autoplan-20261102021943, APPROVED as-is. Every item shipped: failing test first, the fix, the negative control, docs/pregate.md and the TODOS.md P2 note.

TODOS

No TODO items completed in this PR. The P2 "Branches cut before windows-smoke.yml still owe the old Windows lane" item now notes that this check blocks the wrong-workflow clear.

Documentation

Status: current — the branch's own docs/pregate.md update matches the shipped clear --run-url workflow check; no further doc edits needed.

Scope: candidate a563f47..2b3a798 (7 commits: lib/pregate/index.ts, lib/ship-queue.ts, docs/pregate.md, TODOS.md, a changelog.d fragment, two tests); no staged, unstaged or new files. Searched every tracked doc and authored template for clear --remote, --run-url, PREGATE_RECEIPT_INVALID, the new reason codes, windows-free-shard and the ready conflict hint.

Documentation health:

  • docs/pregate.md: Current (updated in this branch; run-evidence and own-profiles text matches clearDecision and the tests: workflow_mismatch, api_error, run_ref_invalid, copied job links, windows-smoke obligation)
  • docs/ship-policy.md: Current (CHANGELOG-only conflict route and hand steps still accurate)
  • docs/troubleshooting.md: Current (nothing contradicted; see debt)
  • TODOS.md: Current (P2 Windows note already names the PR 6 refusal; not edited by this audit)
  • changelog.d/gsta203-pr6-clear-workflow-check.md: Current (consistent with the code; not edited by this audit)

Documentation debt:

  • gstack-pregate clear --run-url refusals (workflow_mismatch, api_error, run_ref_invalid): reference only (docs/pregate.md run evidence, the refusal's own fix line); the PREGATE_RECEIPT_INVALID troubleshooting entry lists --receipt and --run refusals but not these (how-to gap).

Diagram drift: none; no renamed or removed modules.

Test plan

  • bun test test/pregate-clear-runs.test.ts test/gstack-ship-queue.test.ts test/pregate-remote-stamp-only.test.ts test/pregate-from-run.test.ts test/ship-receipt-carry-pregate.test.ts: 54 pass, 0 fail (finish lane)
  • bun run typecheck, bun run typecheck:test (none new), module-size ratchet, bun-entry isolation, harness-version, git-ref and spawnsync tripwires, changelog fragments: pass
  • Remote pregate on frozen head 2b3a798: PREGATE_REMOTE: tree=3c908c18e2b5 tests=10218 failed=0 spent=0.05
  • CI at 2b3a798: 38 success, 0 failure, 12 skipped, including windows-smoke
  • test/pregate-remote.test.ts "a wrong tree, zero tests…" timed out at bun's 5 s default once in a combined run; it is flaky on main a563f47 too (fail 5222 ms, then pass 3638 ms) and this PR does not touch --remote

garrytan and others added 7 commits November 2, 2026 02:20
… lane with no profile (red, GSTA-203 PR 6)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…lane with no profile (GSTA-203 PR 6)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… null run read (GSTA-203 PR 6)

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>
…ofile (red, GSTA-203 PR 6 fix-check)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…step (GSTA-203 PR 6 fix-check)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
… and only its run clears it; the ready conflict hint names each lane's own workflow (GSTA-203 PR 6)

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

trunk-io Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions github-actions Bot changed the title fix(pregate): clear --run-url refuses a run of another workflow v1.92.62.0 fix(pregate): clear --run-url refuses a run of another workflow Nov 2, 2026
@capy-ai
capy-ai Bot merged commit 35817ba into main Nov 2, 2026
56 of 57 checks passed
@capy-ai

capy-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Flaky note: windows-pregate failed once at ef17b85. The cold hook run logged gstack-question-log exited null (run 41406459043). A rerun of the failed job passed on the same head, so it's logged as flaky in the crew ledger for the daily flaky pass. Merged as 35817ba (v1.92.62.0).

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