Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Gate the Postgres managed freshness cell on the median of 3 runs; pin the door's seeded gate set

garrytan36082d153fe4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e534e25e0f..8055b3b8d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,12 +12,13 @@ identifiers and attribution are available in the pre-removal Git revision
## [Unreleased]
-### The nightly Heavy Tests run checks the Codex plugin and old-brain upgrades again
+### Nightly checks stop failing on their own fixtures and sampling
-**Two nightly checks had been failing on their own fixtures, not on gbrain. Both now test what users get.** The Codex plugin check expected gated tools to be listed even when their publish gate was off. The pre-v0.18 upgrade fixture couldn't build its legacy database because a newer trigger depends on the column it removes.
+**Three nightly checks were failing because of how they measure, not because of gbrain. All three now test what users get.** The Codex plugin check expected gated tools to be listed even when their publish gate was off. The pre-v0.18 upgrade fixture couldn't build its legacy database because a newer trigger depends on the column it removes.
- `test/e2e/codex-plugin-install-real.serial.test.ts`: the expected tool list now resolves publish gates the way `gbrain serve` does for the seeded brain over stdio. Wakeshift's `watch_job`, `list_watches` and `unwatch` (#8670) and `set_memory_writeback` (#8481) are listed only when their gate is on. Before this change the check failed every night from 2026-11-06 on; it now passes against codex 0.147.0, the version the workflow pins.
- `tests/heavy/fixtures/down-mutate-pre-v0.18.sql`: before dropping `pages.source_id`, the fixture drops every trigger that depends on that column. The first such trigger was the per-folder access stamp from #8134. The walk forward re-creates those triggers. `tests/heavy/pg_upgrade_matrix.sh` failed on the pre-v0.18 shape before this change and passes on both shapes after it.
+- `scripts/bench/sync-freshness-gate.ts`: the Postgres managed serve-watch cell is now measured 3 times, and the gate uses the median of the three p50s, as the PGLite managed cell already did. The baseline and the 25% limit are unchanged. The cell's nightly p50 moves in steps of the 50 ms probe. Single runs at 656.5, 659.2 and 706.8 ms failed the 627 ms limit on 3 of 19 nightlies, and each passed when rerun on the same commit. A regression that slows every run still fails.
## [0.60.675.0] - 2026-11-11
diff --git a/scripts/bench/sync-freshness-gate.ts b/scripts/bench/sync-freshness-gate.ts
index b8a2dab3bc..53bc3c3be7 100644
--- a/scripts/bench/sync-freshness-gate.ts
+++ b/scripts/bench/sync-freshness-gate.ts
@@ -21,6 +21,9 @@
* p50s against the same baseline and limit: in the sample, the median of each runner's first three runs spans 507.6 to
* 698.9 ms (every 3 consecutive runs: 491.9 to 698.9) against the 916.9 ms limit, where one first run came within 4.1 ms.
* A slow first run on a fresh runner no longer decides the cell alone; a regression that moves every run still does.
+ * Postgres managed is gated the same way since 2026-11-11 (GST-2457): its nightly p50 moves in steps of the 50 ms probe
+ * (452.7 to 601.3 ms on 16 of 19 nightlies from 2026-10-24), and three single runs at 656.5, 659.2 and 706.8 ms failed the
+ * 627 ms limit, each passing again on the same commit (the 706.8 ms run's rerun measured 551.2 ms).
*
* --oracle (GBRA-133 wave 4, untimed): the two managed cells once more with GBRAIN_SYNC_LEVEL_REUSE_VERIFY=1, so the
* serve compares every level read it reused across passes with a whole read (persistence/sync-tree-reuse.ts) and logs
@@ -42,7 +45,7 @@ const CELLS: Record<string, string[]> = {
'pglite-managed-serve-watch': ['--engine', 'pglite', '--mode', 'managed', '--commit', 'single', '--trigger', 'serve', '--detection', 'watch'],
'postgres-classic-serve-watch': ['--engine', 'postgres', '--mode', 'classic', '--commit', 'single', '--trigger', 'serve', '--detection', 'watch'],
};
-const MEASUREMENTS: Record<string, number> = { 'pglite-managed-serve-watch': 3 };
+const MEASUREMENTS: Record<string, number> = { 'pglite-managed-serve-watch': 3, 'postgres-managed-serve-watch': 3 };
const names = flag('cells', Object.keys(CELLS).join(',')).split(',').filter(Boolean);
for (const n of names) if (!CELLS[n]) { console.error('unknown cell ' + n + '; known: ' + Object.keys(CELLS).join(', ')); process.exit(2); }
const WORK = resolve(flag('work-dir', join(REPO, '.context/bench/sync-freshness-gate')));
diff --git a/test/e2e/codex-plugin-install-real.serial.test.ts b/test/e2e/codex-plugin-install-real.serial.test.ts
index 2d521fc6ea..3fe23431bf 100644
--- a/test/e2e/codex-plugin-install-real.serial.test.ts
+++ b/test/e2e/codex-plugin-install-real.serial.test.ts
@@ -238,7 +238,10 @@ describe.skipIf(!PLUGIN_CAPABLE)('codex plugin door — INSTALL (no auth needed)
});
// Publish gates resolve the way serve resolves them for this brain over stdio: a gated op (Wakeshift's watches,
// the memory settings) is listed only when its gate is on, and the seeded brain turns on only publish_skills.
- const publishGates = publishGatesFromDisabled(operations, await seededGateDisabled(seededHome));
+ const gateDisabled = await seededGateDisabled(seededHome);
+ expect(['list_watches', 'set_memory_writeback', 'unwatch', 'watch_job'].filter((name) => !gateDisabled.has(name))).toEqual([]);
+ expect(['get_skill', 'list_skills'].filter((name) => gateDisabled.has(name))).toEqual([]);
+ const publishGates = publishGatesFromDisabled(operations, gateDisabled);
const expected = operations.filter((o) => isCallable(o, { transport: 'stdio', surface: PLUGIN_SURFACE, scopes: [], publishGates })).map((o) => o.name).sort();
expect(tools.sort()).toEqual(expected);
diff --git a/tests/heavy/fixtures/down-mutate-pre-v0.18.sql b/tests/heavy/fixtures/down-mutate-pre-v0.18.sql
index 4eb05c3d94..b58cd658df 100644
--- a/tests/heavy/fixtures/down-mutate-pre-v0.18.sql
+++ b/tests/heavy/fixtures/down-mutate-pre-v0.18.sql
@@ -38,7 +38,7 @@ BEGIN
FOR r IN SELECT DISTINCT t.tgname FROM pg_trigger t
JOIN pg_depend d ON d.classid = 'pg_trigger'::regclass AND d.objid = t.oid
JOIN pg_attribute a ON a.attrelid = d.refobjid AND a.attnum = d.refobjsubid
- WHERE d.refobjid = 'pages'::regclass AND a.attname = 'source_id' AND NOT t.tgisinternal LOOP
+ WHERE d.refclassid = 'pg_class'::regclass AND d.refobjid = 'pages'::regclass AND a.attname = 'source_id' AND NOT t.tgisinternal LOOP
EXECUTE format('DROP TRIGGER %I ON pages', r.tgname);
END LOOP;
END $$;