Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: remote-gate reuse also refuses a tree that changes ci-full-suite-tree.sh or ci-executed-counts.ts
garrytan063646590053
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 79a64f4a87..a9dfc14a06 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,7 +14,7 @@ identifiers and attribution are available in the pre-removal Git revision**The remote gate takes its receipt from GitHub's full-ci when the exact tree already passed there, so a merge slot no longer pays for a second full test pass on Ubicloud.**-`scripts/pregate-remote-gate.sh` prints the `PREGATE_REMOTE:` line that clears /ship's remote-gate obligation, and it used to start Ubicloud VMs every time, even when GitHub had just run the same tests on the same tree. Now, when the working tree is clean and both the Test and E2E full runs passed on GitHub for that exact tree (`full-suite` and `e2e-full-suite` green in the latest attempt, their tree artifacts naming the tree), it prints the same line from those runs and starts no VM. A full run still in progress on the tree is waited for, up to 90 minutes. A full run on the tree that failed refuses with the run's URL instead of spending on VMs. The newest full run on the tree decides, across every recent commit with that tree, so an older pass cannot outrank a newer failure. Any other tree runs the VM gate as before, including a tree that differs only in release stamps (gstack's stamp rule covers that case), a tree that changes `.github/workflows/test.yml`, `.github/workflows/e2e.yml` or `scripts/ci-reuse.ts` relative to master (its runs would attest to themselves), a dirty working tree, or `GBRAIN_PREGATE_REUSE=0`. On reuse, `tests=` counts the executed test identities of both runs.+`scripts/pregate-remote-gate.sh` prints the `PREGATE_REMOTE:` line that clears /ship's remote-gate obligation, and it used to start Ubicloud VMs every time, even when GitHub had just run the same tests on the same tree. Now, when the working tree is clean and both the Test and E2E full runs passed on GitHub for that exact tree (`full-suite` and `e2e-full-suite` green in the latest attempt, their tree artifacts naming the tree), it prints the same line from those runs and starts no VM. A full run still in progress on the tree is waited for, up to 90 minutes. A full run on the tree that failed refuses with the run's URL instead of spending on VMs. The newest full run on the tree decides, across every recent commit with that tree, so an older pass cannot outrank a newer failure. Any other tree runs the VM gate as before, including a tree that differs only in release stamps (gstack's stamp rule covers that case), a tree that changes `.github/workflows/test.yml`, `.github/workflows/e2e.yml`, `scripts/ci-reuse.ts`, `scripts/ci-full-suite-tree.sh` or `scripts/ci-executed-counts.ts` relative to master (its runs would attest to themselves), a dirty working tree, or `GBRAIN_PREGATE_REUSE=0`. On reuse, `tests=` counts the executed test identities of both runs.### Itemized changesdiff --git a/docs/ci-event-parity.md b/docs/ci-event-parity.mdindex 4646d6ca77..0d91a8605d 100644--- a/docs/ci-event-parity.md+++ b/docs/ci-event-parity.md@@ -114,8 +114,8 @@ across the head and every recent head with the same tree, so neither an emptycommit nor an older pass elsewhere skips a newer failure; a failed one refuseswith no receipt. A run that did not run the full job (a diagnostic dispatch, apush that reused) is skipped. A tree that changes `.github/workflows/test.yml`,-`.github/workflows/e2e.yml` or `scripts/ci-reuse.ts` relative to-`origin/master` never reuses, since its runs would attest to themselves, and the+`.github/workflows/e2e.yml`, `scripts/ci-reuse.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 thecheck runs without the model and database keys, like the gate. Every other case runs the gate: a dirty tree, a commit GitHubdoesn't have, a missing workflow, an API error, or `GBRAIN_PREGATE_REUSE=0`.diff --git a/scripts/pregate-remote-gate.sh b/scripts/pregate-remote-gate.shindex 181fe8ed92..159c1630d9 100755--- a/scripts/pregate-remote-gate.sh+++ b/scripts/pregate-remote-gate.sh@@ -84,7 +84,7 @@ if [ "${GBRAIN_PREGATE_REUSE:-1}" != 0 ] && [ -n "$repo" ] && [ "$before" = "$(gecho "pregate-remote-gate: no origin/master to compare the full-ci workflows against, so it runs the gate instead of reusing" >&2reuse_ok=0fi- for path in .github/workflows/test.yml .github/workflows/e2e.yml scripts/ci-reuse.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; do[ "$reuse_ok" = 1 ] || breakgit diff --quiet origin/master HEAD -- "$path" && continueecho "pregate-remote-gate: the tree changes $path relative to origin/master, so it runs the gate instead of reusing its own runs" >&2diff --git a/test/scripts/pregate-remote-gate.test.ts b/test/scripts/pregate-remote-gate.test.tsindex f54c128434..e59f4d59a7 100644--- a/test/scripts/pregate-remote-gate.test.ts+++ b/test/scripts/pregate-remote-gate.test.ts@@ -150,8 +150,8 @@ describe('pregate-remote-gate.sh', () => {expect(spawnSync('cat', [join(repo, '.git', 'reuse-env')], { encoding: 'utf8' }).stdout.trim().split('\n')).toEqual(keys.map(k => `${k}=unset`));});- it('a tree that changes the full-ci workflows or ci-reuse.ts 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']) {+ 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']) {rmSync(join(repo, '.git', 'reuse-args'), { force: true });rmSync(join(repo, '.git', 'gate-ran'), { force: true });mkdirSync(join(repo, path, '..'), { recursive: true });