Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci(remote gate): full-ci runs clear gstack's remote gate via clear --run; a self-attesting tree gets no inventory

garrytan9a1b201512c3
diff --git a/.gstack/pregate.json b/.gstack/pregate.json
index 4e0b3706a6..00fbd9fa6a 100644
--- a/.gstack/pregate.json
+++ b/.gstack/pregate.json
@@ -137,6 +137,24 @@
"visibility": "public"
},
"remote_gate": "bash scripts/pregate-remote-gate.sh",
+ "run_profiles": {
+ "test": {
+ "workflow": "test.yml",
+ "events": ["workflow_dispatch", "push"],
+ "jobs": ["full-suite"],
+ "artifact": "full-suite-tree"
+ },
+ "e2e": {
+ "workflow": "e2e.yml",
+ "events": ["workflow_dispatch", "push"],
+ "jobs": ["e2e-full-suite"],
+ "artifact": "e2e-full-suite-tree"
+ }
+ },
+ "remote_gate_runs": {
+ "profiles": ["test", "e2e"],
+ "inventory": "bash scripts/pregate-remote-gate.sh --list"
+ },
"allowlist": [
{
"finding": "pii.phone.e164",
diff --git a/.gstack/ship-policy.json b/.gstack/ship-policy.json
index 2bc08f52f7..0786e37a40 100644
--- a/.gstack/ship-policy.json
+++ b/.gstack/ship-policy.json
@@ -1,5 +1,6 @@
{
"bump": "patch",
+ "min_gstack_version": "1.91.377.0",
"queue_mode": "stamp-at-merge",
"changelog": "CHANGELOG.md",
"stamp_files": [
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5dc546c4bf..9943dc76ee 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,15 @@ 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, 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.
+
+### 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` 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.
+- `docs/ci-event-parity.md`: the profiles and the refusal.
+
## [0.60.538.0] - 2026-11-01
**Agents connected over MCP now see the chronicle reads, takes reads and a quoted page's title and frontmatter quoted as source material, and the context gbrain's hooks inject quotes facts below "your notes" too.**
diff --git a/docs/ci-event-parity.md b/docs/ci-event-parity.md
index a7b848c808..45af5e1410 100644
--- a/docs/ci-event-parity.md
+++ b/docs/ci-event-parity.md
@@ -157,7 +157,11 @@ inventory:
command with `--list` (`scripts/ci-ubicloud.ts --list`), the same lanes and
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). The gate leaves out the keyed-only
+ 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
+ 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
openclaw, so every test in it would skip.
- gstack accepts only `push` and `workflow_dispatch` runs whose newest attempt
@@ -166,10 +170,13 @@ inventory:
included, over from the older attempt, so the new attempt has no manifest of
its own and its `tree.json` has no `files` (`inventory_uncovered`); a
`tree.json` left from an older attempt is refused too (`artifact_mismatch`).
-- The profiles live in the base branch's `.gstack/pregate.json` (`run_profiles`
- for `test.yml` / `full-suite` and `e2e.yml` / `e2e-full-suite`, and
- `remote_gate_runs` with this inventory command). gstack reads them only from
- `origin/<base>`, so they apply to a branch once they are on master.
+- The profiles live in `.gstack/pregate.json`: `run_profiles` `test`
+ (`test.yml`, job `full-suite`, artifact `full-suite-tree`) and `e2e`
+ (`e2e.yml`, job `e2e-full-suite`, artifact `e2e-full-suite-tree`), each
+ accepting `workflow_dispatch` and `push` runs from the last 24 hours, and
+ `remote_gate_runs` naming both with this inventory command. gstack reads them
+ only from `origin/<base>`, so a branch cannot loosen them. gstack accepts
+ these keys from 1.91.377.0 on.
## Dependency-audit rule
diff --git a/scripts/pregate-remote-gate.sh b/scripts/pregate-remote-gate.sh
index e9a8ffc4a2..4f5cb86c29 100755
--- a/scripts/pregate-remote-gate.sh
+++ b/scripts/pregate-remote-gate.sh
@@ -60,16 +60,34 @@ set -uo pipefail
fail() { echo "pregate-remote-gate: $1" >&2; exit "${2:-1}"; }
+# Whether the checked-out commit's own full-ci runs may vouch for it: never when
+# it changes the full-ci workflows or the scripts that attest their runs relative
+# to origin/master (or there is no origin/master to compare against). Prints the
+# reason on stderr and returns 1 when they may not.
+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
+ 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
+ done
+}
+
# --list prints the test files the gate would run on the checked-out tree, one
# per line: the gate command with --list (ci-ubicloud.ts --list, the same
# selection and inventory), so gstack-pregate clear --run can check that the
# full-ci runs it is given executed every one (remote_gate_runs.inventory,
# docs/ci-event-parity.md#remote-gate-reuse). A failing or empty inventory exits
-# non-zero. It starts no VM and needs no UBI_OWNER.
+# non-zero, and so does a tree whose runs may not attest to it (runs_may_attest)
+# or GBRAIN_PREGATE_REUSE=0, so gstack refuses the runs and the gate runs. It
+# starts no VM and needs no UBI_OWNER.
if [ "${1:-}" = "--list" ]; then
shift
TOP=$(git rev-parse --show-toplevel 2>/dev/null) || fail "not inside a git checkout" 2
cd "$TOP" || exit 2
+ [ "${GBRAIN_PREGATE_REUSE:-1}" != 0 ] || fail "GBRAIN_PREGATE_REUSE=0: no inventory, so no full-ci run clears the gate; run the gate" 1
+ runs_may_attest || fail "no inventory, so no full-ci run clears the gate; run the gate (bash scripts/pregate-remote-gate.sh)" 1
listed=$(bash -c "${GBRAIN_PREGATE_GATE_CMD:-bun run ci:ubicloud:diff} --list \"\$@\"" pregate-remote-gate "$@") || fail "the gate's inventory failed (exit $?); no list" 1
[ -n "$listed" ] || fail "the gate's inventory is empty; no list" 1
printf '%s\n' "$listed"
@@ -107,16 +125,7 @@ reused=""
repo=${GBRAIN_PREGATE_REPO:-$(git remote get-url origin 2>/dev/null | sed -E 's#\.git$##' | sed -nE 's#^.*[/:]([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)$#\1#p')}
reuse_ok=1
if [ "${GBRAIN_PREGATE_REUSE:-1}" != 0 ] && [ -n "$repo" ] && [ "$before" = "$(git rev-parse 'HEAD^{tree}' 2>/dev/null)" ]; then
- if ! git rev-parse -q --verify 'origin/master^{commit}' >/dev/null; then
- echo "pregate-remote-gate: no origin/master to compare the full-ci workflows against, so it runs the gate instead of reusing" >&2
- reuse_ok=0
- fi
- 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
- [ "$reuse_ok" = 1 ] || break
- git diff --quiet origin/master HEAD -- "$path" && continue
- echo "pregate-remote-gate: the tree changes $path relative to origin/master, so it runs the gate instead of reusing its own runs" >&2
- reuse_ok=0
- done
+ runs_may_attest || { echo "pregate-remote-gate: so it runs the gate instead of reusing" >&2; reuse_ok=0; }
else
reuse_ok=0
fi
diff --git a/test/scripts/pregate-remote-gate.test.ts b/test/scripts/pregate-remote-gate.test.ts
index 16d3312586..b775d0ae65 100644
--- a/test/scripts/pregate-remote-gate.test.ts
+++ b/test/scripts/pregate-remote-gate.test.ts
@@ -268,6 +268,7 @@ describe('pregate-remote-gate.sh', () => {
});
describe('pregate-remote-gate.sh --list', () => {
+ beforeEach(() => git('update-ref', 'refs/remotes/origin/master', 'HEAD'));
/** Runs --list with `gate` as the gate command and no UBI_OWNER. */
const list = (gate: string | undefined, args: string[] = [], env: Record<string, string> = {}) => {
const r = spawnSync('bash', [SCRIPT, '--list', ...args], {
@@ -314,4 +315,24 @@ describe('pregate-remote-gate.sh --list', () => {
expect(failing.err).toContain("the gate's inventory failed (exit 3)");
for (const r of [empty, failing]) expect(r.out + r.err).not.toContain('PREGATE_REMOTE');
});
+
+ it('a tree whose full-ci runs would attest to themselves gets no inventory, so gstack clear --run refuses it and the gate runs', () => {
+ 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(''); };
+ 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']) {
+ mkdirSync(join(repo, path, '..'), { recursive: true });
+ writeFileSync(join(repo, path), `changed ${path}\n`);
+ git('add', '.');
+ git('commit', '-q', '-m', `change ${path}`);
+ const r = list(gate);
+ refused(r);
+ expect(r.err).toContain(`pregate-remote-gate: the tree changes ${path} relative to origin/master`);
+ expect(r.err).toContain('no inventory');
+ git('update-ref', 'refs/remotes/origin/master', 'HEAD');
+ }
+ refused(list(gate, [], { GBRAIN_PREGATE_REUSE: '0' }));
+ git('update-ref', '-d', 'refs/remotes/origin/master');
+ refused(list(gate));
+ expect(spawnSync('test', ['-e', join(repo, '.git', 'list-ran')]).status).not.toBe(0);
+ });
});