Skip to content

v1.91.377.0 pregate: clear the remote gate with verified Actions runs on the same tree (clear --run) - #3592

Merged
capy-ai[bot] merged 15 commits into
mainfrom
capy/gsta156-run-evidence
Oct 31, 2026
Merged

capy-ai[bot] merged 15 commits into
mainfrom
capy/gsta156-run-evidence

Conversation

@garrytan

@garrytan garrytan commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3592,
  "head": "f0f4ca707100478deaa0d8196ea9df900d5f21f5",
  "version": "1.91.365.0",
  "base": "main",
  "gate": {
    "remote-free": {
      "pass": 1993,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "577891788a94e7356395e27d4542588ca4eca07b",
  "product_patch_id": "d3f92746670714df770bc2a5f22054c16a0f0bc4",
  "gstack_version": "1.91.366.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 586,
    "rules": "150435b0a543019a",
    "base": "4a2793ed82e8c2ac88c8d39a244fe6de0fb084fa",
    "registry": "4a2793ed82e8c2ac88c8d39a244fe6de0fb084fa",
    "gate_scan": {
      "tagged": 0,
      "head": "f0f4ca707100478deaa0d8196ea9df900d5f21f5"
    },
    "reasons": [
      "gate-class",
      "runtime=586>50"
    ]
  },
  "pregate": "requires-remote cleared @577891788a94 (7 checks, current for f0f4ca707100)",
  "requires_remote": [
    "windows-free-tests.yml/windows-free-shard: https://github.com/garrytan/gstack/actions/runs/41207036595",
    "pregate.json/remote_gate: remote-gate tree=577891788a94 tests=1993 receipt=/home/user/.capy/work/gsta156/ship-r3/remote-receipt.txt sha256=bccafb40b6cf"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md searched for pregate clear, run_profiles, remote_gate_runs and the run-evidence rules; docs/pregate.md and docs/troubleshooting.md updated"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 8,
    "deferred": 0,
    "noted": 8,
    "fixed": 7,
    "scope": "frozen",
    "fix_checks": 2,
    "dispatches": {
      "specialist": 3,
      "red-team": 3
    }
  }
}

What changed

The remote gate gains a third way to clear: verified GitHub Actions runs on the same tree (clear --run), so a repository stops running its full suite twice per slot

The remote gate gains a third way to clear: verified GitHub Actions runs on the same tree (clear --run), so a repository stops running its full suite twice per slot.

Before/after as text: The remote gate gains a third way to clear: verified GitHub Actions runs on the same tree (clear --run), so a repository stops running its full suite twice per slot
--- Before · docs/pregate.md § Small machines and the remote gate at 4729f47 · source text
+++ After · docs/pregate.md § Small machines and the remote gate on this branch · source text
@@ ⋯ 14 unchanged ⋯ @@
   accepted and recorded, see [below](#remote-gate-stamp-only)), or
   `gstack-pregate clear --remote test_backend/<backend> --run-url <url>`, which
   has no machine-checkable receipt and is recorded as `attested:<url>`; or
+- when CI already ran the full suite on this tree, `gstack-pregate clear --remote
+  pregate.json/remote_gate --run <id|url> [--run …] --allow-repo-commands`, one
+  verified GitHub Actions run per `remote_gate_runs` profile (see
+  [run evidence](#run-evidence)); or
 - `gstack-pregate --stage tests --remote --spend-cap <usd> --allow-repo-commands`,

Why

GBRA-108: "#7872's slot took 5.6 h". Every gbrain slot ran its Ubicloud remote gate (30–45 min) and then a full-ci dispatch (18–20 min) on the identical tree. With run_profiles declared on its base branch, gbrain runs the suite once in CI and gstack-pregate clear --run turns those runs into the gate's receipt, checked against GitHub's own record instead of a pasted URL.

Blast radius

The new path runs only when a base branch declares run_profiles/remote_gate_runs in .gstack/pregate.json. gstack's own base declares none, so --receipt, --run-url and --bundle-lane behave as before for gstack and for every repository without profiles. Evidence: the unprofiled-lane and receipt-route tests in test/pregate-clear-runs.test.ts ran, and the remote gate passed at f0f4ca7 (1993 tests, 0 failed, tree 577891788a94). Two edges now fail closed where they used to record. A lane the base profiles refuses --bundle-lane, and an unreadable or invalid base config refuses --run-url/--bundle-lane on every lane. A clear whose pregate.json was rewritten while it ran now refuses instead of writing the old copy back.

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

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

Summary

gbrain asked for one full suite per tree. gstack-pregate clear --remote pregate.json/remote_gate --run <id> --run <id> accepts one run per profile the base declares. Each run is checked against the GitHub API (repository, event, newest attempt, every named job passing once, no run on the head that started at or after it and went red, age from its jobs' completion, OS) and against the tree.json it uploaded (run, attempt, event, head, and the tree git computes for that head). The runs must share one tree, either pregate.json's or a stamp-only predecessor of it, and their files must cover the obligation's tests plus everything the declared inventory command lists. Before the receipt is written, every run is read once more, and the inventory runs under pipefail. verify stays offline and refuses a run receipt recorded for another tree. A lane with its own profile clears the same way, and its --run-url goes through the verifier. The verifier's GitHub reads and its head fetch are recorded in the egress ledger (sink run-evidence). Refusals print REUSE: refused reason=<code>, and success prints REUSE: accepted.

This re-ship fixed a bug the earlier review missed. On a Capy machine, url.insteadOf rewrites origin to git.capy.ai, so clear --run could never read the GitHub repository. Origin is now read from remote.origin.url and normalized the way the ship queue already does.

The release note is the fragment changelog.d/capy-gsta156-run-evidence.md; the merge stamps it. Main was merged once at a305302 (cc22404) under GStack Minder's rule 19 grant. The only code conflict, lib/pregate/config.ts, was resolved as the union of main's timeout_s key and this PR's run_profiles/remote_gate_runs, and the review read that file in full.

Plan deviations, approved in the decision trail. Verify does not re-call GitHub (row 12). The schema key is remote_gate_runs rather than remote_gate.accept_runs (row 11). The veto covers the run's head and pregate.json's head, not every head carrying the tree (row 29). REUSE lines print on clear outcomes only (row 24).

Deferred to the next PRs of this plan: gstack-ship-queue ready --dispatch-ci still records lane runs by URL, and offline verify cannot yet demand a verified receipt for profiled lanes (P3b, with gstack's own profiles and main-push reuse). Clear does not dispatch until green. A push after clear is caught by the tree check, not by clear. The workflow file and the inventory command are the branch's own, as the remote gate script already is.

Test Coverage

Tests: test/run-evidence.test.ts (new), test/pregate-clear-runs.test.ts (new), test/pregate-user-policy.test.ts (extended), test/egress-receipt-wiring.test.ts (run-evidence registered as a sink). Five regression tests added in this re-ship each failed before their fix: the insteadOf origin, the same-second veto, freshness from job completion, the pipefail inventory, and a run that turns red while the clear is assembled.

Untested paths, all of which fail closed: the REUSE: accepted stdout line (needs a gh stub), the bin's inventory working-tree guards, the re-read of pregate.json before the write, and gh pagination and the artifact size bound.

Tests ran: remote-free 1993

Pre-Landing Review

No blocking findings remain. Pass 1 (specialists on testing, security and state machines, then a red team) found one blocker: clear --run could not read the GitHub repository behind Capy's git.capy.ai proxy. It is fixed with a regression test. Pass 2 found two informational items, both noted below. Step 11 ran the native adversarial pass (Opus) and the outside voice (GPT-6.1 Sol). The outside voice raised three gate escapes: an inventory pipeline without pipefail, a run turning red during a multi-profile clear, and same-second runs skipping the veto. The native pass raised four fixable items. The tooling classified all seven as blocking. Five are fixed in code with tests, and two (re-running only the failed jobs refuses, and the size cap reads the zip) are documented limits that fail closed. The fix-check on those fixes found one stale sentence, now fixed, and a second fix-check on the prose found nothing. A first review pass ran against a stale local main ref and read main's own history. It was discarded and rerun on the right base.

REVIEW_LOOP: passes=2 blocking_found=8 deferred=0 noted=8 fixed=7 scope=frozen fix_checks=2 dispatches=6

Gate edits: none detected (gate scan tagged 0 hunks at f0f4ca7's reviewed range)

Outside review: GPT-6.1 Sol (Step 11), completed.

Review notes

  • lib/pregate/index.ts verify: only clear enforces "a profiled lane clears through verified runs". ready --dispatch-ci, an older gstack, or a hand edit can still record a plain URL that verify accepts. This is P3b; the fragment now says so.
  • bin/gstack-pregate runCheck: the inventory closure's three guards (no --allow-repo-commands, a working tree that is not pregate.json's, a tree that changes while it runs) have no test.
  • lib/run-evidence.ts: the 8 MiB bound checks the zipped artifact size, and gh run download extracts before tree.json's size is checked. Only a workflow on the branch itself can do this, and the temporary directory is removed.
  • Re-running only the failed jobs refuses with artifact_mismatch unless the job that uploads tree.json re-runs too (documented).
  • The branch's own workflow, tree.json and inventory certify the run, the same trust the remote gate script already has. Diffs to profiled workflows and the inventory script are gate changes.
  • An older red run on the same tree that started before the candidate does not veto it, and runs on other heads carrying the same tree are not checked.
  • Older gstack versions reject run_profiles as an unknown key, so gbrain should commit profiles only after its lanes upgrade (the gbrain handoff note says so).
  • The pregate secrets warn (MEDIUM internal.hostname, lib/pregate/config.ts) matches the property read o.local in parseConfig's return. It is benign and not allowlisted.
  • The lib/result-codes.ts fix strings for PREGATE_RECEIPT_INVALID and PREGATE_REMOTE_UNCLEARED do not mention --run. docs/troubleshooting.md does.

Plan Completion

P3a items 1–7: done or changed with a trail row. Item 7, the gbrain handoff note, is in GStack Minder's drive at handoffs/GSTA-156/gbrain-note.md.

TODOS

No TODO items completed in this PR.

Documentation

Status: updated. Two factual fixes in docs/pregate.md; no blockers.

Scope: base a305302..26f8407 on capy/gsta156-run-evidence (11 committed files; nothing staged, unstaged or untracked). Audited the authored docs this change touches (docs/pregate.md, docs/troubleshooting.md, changelog.d/capy-gsta156-run-evidence.md) against bin/gstack-pregate, lib/pregate/config.ts, lib/pregate/index.ts and lib/run-evidence.ts. Also checked docs/ship-policy.md, CONTRIBUTING.md, ARCHITECTURE.md and docs/PROJECT_STRUCTURE.md for knock-on drift. Banned terms: none (no list on main).

Documentation health:

  • docs/pregate.md: Updated. The user-owned policy paragraph now names run_profiles and remote_gate_runs as refused in the user file (an empty run_profiles is accepted), and the remote gate section now says "one of three ways" (was "two") after the new clear --run bullet.
  • docs/troubleshooting.md: Current. The changed entries match the code, including the quoted REUSE: refused reason=<code> line.
  • changelog.d/capy-gsta156-run-evidence.md: Current (read only; matches the code).
  • docs/ship-policy.md: Current. The --dispatch-ci and --run-url route is unchanged, because gstack declares no run_profiles.
  • CONTRIBUTING.md: Current.
  • ARCHITECTURE.md: Current (no pregate entities).
  • docs/PROJECT_STRUCTURE.md: Current.

Documentation Debt

  • gstack-pregate clear --run, run_profiles and remote_gate_runs: reference, how-to and explanation are in docs/pregate.md#run-evidence; no tutorial.
  • ⚠️ The tree.json artifact contract has reference coverage only. A how-to with a sample workflow step that writes and uploads tree.json is missing.
  • gstack-ship-queue ready --dispatch-ci on profiled lanes: the known limitation (planned follow-up P3b) is documented only in docs/pregate.md.
  • Diagram drift: none.

Suggested follow-up: /document-generate for the tree.json how-to; consider a docs-debt label.

Test plan

  • UBI_OWNER=gsta156 gstack-pregate --allow-repo-commands --remote --spend-cap 2 --timeout 2700 at f0f4ca7: remote gate 1993 tests, 0 failed on tree 577891788a94 ($0.05; the VM was destroyed, 0 left for owner gsta156). windows-free-shard cleared from the PR's Windows Free Tests run 41207036595 (green); Free Tests run 41207036618 is green at the same head. gstack-pregate verify ok.
  • Focused lane at f0f4ca7: run-evidence, pregate-clear-runs, pregate-user-policy, egress-receipt-wiring and every tripwire and ratchet test, green (all 115 of them).
  • bun run typecheck clean.
  • On this 2-core machine, 4 pregate-dart tests and 2–3 pregate-regate tests fail or time out. They fail the same way at main a305302, so the cause is this machine, not the change, and the remote gate passed both files.

garrytan and others added 8 commits October 29, 2026 04:18
… tree (clear --run)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…pt bind end to end

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…il closed, no pull_request runs, user-policy keys)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…sed, lane coverage, run re-read, base binding, paging, artifact bound, full assignment)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ered reason, unreadable-base and user-policy tests)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…user policy, verify's foreign-tree run receipt

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>
…ledger (sink run-evidence)

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

trunk-io Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

…vocation tripwire)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
capy-ai Bot added a commit that referenced this pull request Oct 30, 2026
…k/always-run.json (GST-167 PR 1, GST-98) (#3626)

* pregate: always run the whole-tree tests listed in .gstack/always-run.json

A diff-selected run never maps a touched file to a scanner that reads the whole tree, so tripwires, ratchets and conformance tests passed the selected gate and failed CI after review (#3592, #3593). The lanes selection now adds every tracked test the list's globs name whenever the branch selects a test, owes a lane or edits the list.

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

* docs(pregate): restore the truncated pregate.md tail; cite seeded durations for the always-run list

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

* docs(changelog): [Unreleased] entry for the pregate always-run list

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>
garrytan and others added 6 commits October 31, 2026 12:37
…ence

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

# Conflicts:
#	CHANGELOG.md
#	lib/pregate/config.ts
…s git.capy.ai proxy still names the GitHub repository

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…eto, inventory runs under pipefail, freshness reads job completion, and a pregate.json rewritten mid-clear refuses

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…; quote clear's real refusal line

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ate clears one of three ways

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title pregate: clear the remote gate with verified Actions runs on the same tree (clear --run) v1.91.377.0 pregate: clear the remote gate with verified Actions runs on the same tree (clear --run) Oct 31, 2026
@capy-ai
capy-ai Bot merged commit c830c9b into main Oct 31, 2026
63 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