Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(pregate): a tree that changes scripts/ci-manifest.ts no longer attests to itself

garrytan43cc465fb4a8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7e072b0ac..0d3f848fd4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,13 +31,13 @@ identifiers and attribution are available in the pre-removal Git revision
- `.github/workflows/heavy-tests.yml`: the schedule requests the credentialed lane (`GBRAIN_PAID_LANES=0` still turns it off), the keyless lane expects 4 passes and its summary warns that no nonce check gates the run when `GBRAIN_PAID_LANES=0`, the credentialed step keeps provider keys, and the canary sets `GBRAIN_REAL_OPENCODE_FREE_TIER_E2E=1`. `test/scripts/heavy-door-workflow.test.ts` pins all four.
- `docs/mcp/OPENCODE-CLI-PIN.md`: the per-IP free cap, where its trace is logged, the new gating split and two triage rows.
-**A merge slot's full-ci runs can now clear gstack's remote gate on their own, so each tree runs the full suite once.** `gstack-pregate clear --remote pregate.json/remote_gate --run <Test run> --run <E2E run> --allow-repo-commands` verifies both runs on GitHub (same tree, both full jobs green in the newest attempt, no newer red run, under 24 hours old) and checks that the files they executed cover the gate's inventory. Checked against Test run 41342917113 and E2E run 41342918866 on one tree: `REUSE: accepted … tests=68132` and `PREGATE_VERIFY: ok`, with all 5,701 inventory files covered. A tree that changes the full-ci workflows or the scripts that attest their runs still can't vouch for itself. It gets no inventory, so gstack refuses those runs and the gate runs, the same rule remote-gate reuse already follows.
+**A merge slot's full-ci runs can now clear gstack's remote gate on their own, so each tree runs the full suite once.** `gstack-pregate clear --remote pregate.json/remote_gate --run <Test run> --run <E2E run> --allow-repo-commands` verifies both runs on GitHub (same tree, both full jobs green in the newest attempt, no newer red run, under 24 hours old) and checks that the files they executed cover the gate's inventory. Checked against Test run 41342917113 and E2E run 41342918866 on one tree: `REUSE: accepted … tests=68132` and `PREGATE_VERIFY: ok`, with all 5,701 inventory files covered. A tree that changes the full-ci workflows or the scripts that attest their runs still can't vouch for itself. It gets no inventory, so gstack refuses those runs and the gate runs, the same rule remote-gate reuse already follows. That rule now covers seven files: `ci-manifest.ts` joins the list.
### Itemized changes
- `.gstack/pregate.json`: `run_profiles` `test` (`test.yml`, `full-suite`, artifact `full-suite-tree`) and `e2e` (`e2e.yml`, `e2e-full-suite`, artifact `e2e-full-suite-tree`), both accepting `workflow_dispatch` and `push`, plus `remote_gate_runs` with `bash scripts/pregate-remote-gate.sh --list` as the inventory.
- `.gstack/ship-policy.json`: `min_gstack_version` 1.91.377.0, the first gstack that reads these keys. An older gstack now refuses with an upgrade fix instead of an invalid-config error.
-- `scripts/pregate-remote-gate.sh`: `--list` refuses (no inventory) for a tree that changes `test.yml`, `e2e.yml`, `ci-reuse.ts`, `ci-full-suite-tree.sh`, `ci-executed-counts.ts` or `lib/gh-issue.ts`, or the inventory's own builders `pregate-remote-gate.sh` and `ci-ubicloud.ts`, relative to `origin/master`, when there is no `origin/master`, and under `GBRAIN_PREGATE_REUSE=0`. The reuse path and `--list` share one check. `test/scripts/pregate-remote-gate.test.ts` pins this.
+- `scripts/pregate-remote-gate.sh`: the files whose change stops a tree's own full-ci runs from attesting to it are now seven: `test.yml`, `e2e.yml`, `ci-reuse.ts`, `ci-full-suite-tree.sh`, `ci-executed-counts.ts`, `lib/gh-issue.ts` and, new, `ci-manifest.ts`, which writes the `ci-manifest.json` that `ci-full-suite-tree.sh` trusts for completeness, executed files and counts. A tree that changes `ci-manifest.ts` therefore no longer reuses its full-ci and runs the gate. `--list` refuses (no inventory) for a tree that changes any of the seven, or the inventory's own builders `pregate-remote-gate.sh` and `ci-ubicloud.ts`, relative to `origin/master`, when there is no `origin/master`, and under `GBRAIN_PREGATE_REUSE=0`. Both paths run one check, and `--list` adds the two builders. `test/scripts/pregate-remote-gate.test.ts` pins this.
- `docs/ci-event-parity.md`: the profiles and the refusal.
**`ubi-runner.sh reap` now destroys only the caller's own VMs, and pack, usage and reap work on macOS and on an empty project (gstack #3756, #3746).** Reap used to destroy any owner's VM whose TTL had ended. That is how one project's `up` destroyed another lane's VMs (GST-573). Now it destroys only VMs whose owner tag equals `UBI_OWNER` and logs `reap: left N expired VMs of other owners` for the rest. The operator reaper, `reap-expired.ts`, still covers every owner. gbrain keeps `UBI_REAP=0` by default, so `up` still reaps nothing unless asked. On macOS, `pack` exited 1 under bsdtar after the VM was already created. On a project with no VMs, Ubicloud's bare-newline list read as a VM named `-`, and reap died on it. A failed size read made `usage` print a short total, which the quota preflight took as room.
diff --git a/docs/ci-event-parity.md b/docs/ci-event-parity.md
index 87245c1acb..9c31aeb8c1 100644
--- a/docs/ci-event-parity.md
+++ b/docs/ci-event-parity.md
@@ -130,7 +130,7 @@ commit nor an older pass elsewhere skips a newer failure; a failed one refuses
with no receipt. A run that did not run the full job (a diagnostic dispatch, a
push that reused) is skipped. A tree that changes `.github/workflows/test.yml`,
`.github/workflows/e2e.yml`, `scripts/ci-reuse.ts`, `scripts/lib/gh-issue.ts`,
-`scripts/ci-full-suite-tree.sh` or `scripts/ci-executed-counts.ts` relative to `origin/master` never reuses, since its runs would attest to themselves, and the
+`scripts/ci-full-suite-tree.sh`, `scripts/ci-executed-counts.ts` or `scripts/ci-manifest.ts` (which writes the run's `ci-manifest.json`) relative to `origin/master` never reuses, since its runs would attest to themselves, and the
check runs without the model and database keys, like the gate. Every other case runs the gate: a dirty tree, a commit GitHub
doesn't have, a missing workflow, an API error, or `GBRAIN_PREGATE_REUSE=0`.
@@ -161,8 +161,10 @@ inventory:
discovery the gate runs, one file per line. It exits non-zero when the
inventory fails or is empty (a doc-only tree under `:diff` runs no test file,
so it clears through the gate as before). It also prints no inventory for a
- tree that changes one of the six files above relative to `origin/master`
- (or when there is no `origin/master`, or `GBRAIN_PREGATE_REUSE=0`), so
+ tree that changes one of the seven files above, or the inventory's own
+ builders `scripts/pregate-remote-gate.sh` and `scripts/ci-ubicloud.ts`,
+ relative to `origin/master` (or when there is no `origin/master`, or
+ `GBRAIN_PREGATE_REUSE=0`), so
gstack refuses that tree's own runs (`inventory_failed`) and the gate runs,
as remote-gate reuse already does. The gate leaves out the keyed-only
Tier 2 file (`test/e2e/skills.test.ts`): a VM has neither the keys nor
diff --git a/scripts/pregate-remote-gate.sh b/scripts/pregate-remote-gate.sh
index 9cdd48d26e..d69bbb2157 100755
--- a/scripts/pregate-remote-gate.sh
+++ b/scripts/pregate-remote-gate.sh
@@ -19,8 +19,8 @@
# Any other tree, a stamp-only one included, runs the gate below; gstack's
# stamp rule (`gstack-pregate clear --receipt`) handles a stamp-only head.
# A tree that changes .github/workflows/test.yml, .github/workflows/e2e.yml,
-# scripts/ci-reuse.ts, scripts/lib/gh-issue.ts, scripts/ci-full-suite-tree.sh or
-# scripts/ci-executed-counts.ts relative to origin/master (or has no
+# scripts/ci-reuse.ts, scripts/lib/gh-issue.ts, scripts/ci-full-suite-tree.sh,
+# scripts/ci-executed-counts.ts or scripts/ci-manifest.ts relative to origin/master (or has no
# origin/master) never reuses: its runs would attest to themselves. The reuse check runs
# without the model and database keys, like the gate.
# GBRAIN_PREGATE_REUSE=0 always runs the gate.
@@ -68,7 +68,7 @@ fail() { echo "pregate-remote-gate: $1" >&2; exit "${2:-1}"; }
runs_may_attest() {
git rev-parse -q --verify 'origin/master^{commit}' >/dev/null || { echo "pregate-remote-gate: no origin/master to compare the full-ci workflows against" >&2; return 1; }
local path
- for path in .github/workflows/test.yml .github/workflows/e2e.yml scripts/ci-reuse.ts scripts/ci-full-suite-tree.sh scripts/ci-executed-counts.ts scripts/lib/gh-issue.ts "$@"; do
+ for path in .github/workflows/test.yml .github/workflows/e2e.yml scripts/ci-reuse.ts scripts/ci-full-suite-tree.sh scripts/ci-executed-counts.ts scripts/ci-manifest.ts scripts/lib/gh-issue.ts "$@"; do
git diff --quiet origin/master HEAD -- "$path" && continue
echo "pregate-remote-gate: the tree changes $path relative to origin/master, so its own runs cannot attest to it" >&2
return 1
diff --git a/test/scripts/pregate-remote-gate.test.ts b/test/scripts/pregate-remote-gate.test.ts
index 307c0f883a..cf702e1974 100644
--- a/test/scripts/pregate-remote-gate.test.ts
+++ b/test/scripts/pregate-remote-gate.test.ts
@@ -190,7 +190,7 @@ describe('pregate-remote-gate.sh', () => {
});
it('a tree that changes the full-ci workflows or the scripts that attest its runs relative to origin/master never reuses its own runs', () => {
- for (const path of ['.github/workflows/test.yml', '.github/workflows/e2e.yml', 'scripts/ci-reuse.ts', 'scripts/ci-full-suite-tree.sh', 'scripts/ci-executed-counts.ts', 'scripts/lib/gh-issue.ts']) {
+ for (const path of ['.github/workflows/test.yml', '.github/workflows/e2e.yml', 'scripts/ci-reuse.ts', 'scripts/ci-full-suite-tree.sh', 'scripts/ci-executed-counts.ts', 'scripts/lib/gh-issue.ts', 'scripts/ci-manifest.ts']) {
rmSync(join(repo, '.git', 'reuse-args'), { force: true });
rmSync(join(repo, '.git', 'gate-ran'), { force: true });
mkdirSync(join(repo, path, '..'), { recursive: true });
@@ -324,7 +324,7 @@ describe('pregate-remote-gate.sh --list', () => {
const gate = 'touch .git/list-ran; echo test/a.test.ts';
const refused = (r: { code: number | null; out: string }) => { expect(r.code).toBe(1); expect(r.out).toBe(''); };
// pregate-remote-gate.sh and ci-ubicloud.ts build the inventory itself, and gstack runs the branch's own copy.
- for (const path of ['.github/workflows/test.yml', '.github/workflows/e2e.yml', 'scripts/ci-reuse.ts', 'scripts/ci-full-suite-tree.sh', 'scripts/ci-executed-counts.ts', 'scripts/lib/gh-issue.ts', 'scripts/pregate-remote-gate.sh', 'scripts/ci-ubicloud.ts']) {
+ for (const path of ['.github/workflows/test.yml', '.github/workflows/e2e.yml', 'scripts/ci-reuse.ts', 'scripts/ci-full-suite-tree.sh', 'scripts/ci-executed-counts.ts', 'scripts/lib/gh-issue.ts', 'scripts/ci-manifest.ts', 'scripts/pregate-remote-gate.sh', 'scripts/ci-ubicloud.ts']) {
mkdirSync(join(repo, path, '..'), { recursive: true });
writeFileSync(join(repo, path), `changed ${path}\n`);
git('add', '.');