Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: pre-landing review fixes
garrytan6800b3ec4b22
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 0e5e064c39..1489995c61 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,7 +16,7 @@ identifiers and attribution are available in the pre-removal Git revision### Itemized changes-- New `scripts/stable-daily.ts` and `.github/workflows/stable-daily.yml`: the reason (a released `stable:important` fix stable lacks, or the 7-day weekly floor), the candidate (newest release on master newer than stable with a successful full soak of its exact tree, both default cells for at least 2 hours with privacy probes run, and `privacy_leaks`, `read_errors`, `version_skew`, `residents_alive` and `session_refusals` passing in every cell; on the important-only path it must contain the fix), one soak dispatch when nothing qualifies (never while a soak runs, never twice on one tree), the rollback pause and the kill switch. A manual dispatch defaults to a dry run, and `dry_run=false` needs an admin or maintainer before it writes anything.+- New `scripts/stable-daily.ts` and `.github/workflows/stable-daily.yml`: the reason (a released `stable:important` fix stable lacks, or the 7-day weekly floor), the candidate (newest release on master newer than stable with a successful full soak of its exact tree, both default cells for at least 2 hours on the 600,000-page fixture with privacy probes run, and `privacy_leaks`, `read_errors`, `version_skew`, `residents_alive` and `session_refusals` passing in every cell; on the important-only path it must contain the fix), one soak dispatch when nothing qualifies (never while a soak runs, never twice on one tree), the rollback pause and the kill switch. A manual dispatch defaults to a dry run, and `dry_run=false` needs an admin or maintainer before it writes anything.- `scripts/promote-stable.ts`: `scheduleAuthorized()` lets only a schedule event of `stable-daily.yml` on the default branch promote without the admin or maintain role; every other check is unchanged, and the record's `promoted_by` names the schedule. Manual dispatches keep the maintainer check.- `docs/RELEASING.md#daily-stable-check` documents the label, the schedule, the kill switch and the rollback.- `test/scripts/stable-daily.test.ts` covers the authorization, the integrity gates, each reason and no-op path, the soak dispatch rules, the dry run and the workflow shape.diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 08b63b9d20..a6d4252864 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -662,7 +662,8 @@ and keeps stable between one day and one week behind what matters:`read_errors`, `version_skew`, `residents_alive`, `session_refusals`)passing in every cell; the latency gates stay record-only. The soak must bethe full default one: both the 65 ms and 2 ms cells, at least 2 hours each,- with privacy probes run, so a short smoke dispatch never qualifies. On the important-only path the candidate must contain the fix.+ on the 600,000-page fixture, with privacy probes run, so a smaller smoke+ dispatch never qualifies. On the important-only path the candidate must contain the fix.It is promoted through the same `promote()` as a manual promotion, so everycheck above still applies and the record's `promoted_by` is`schedule (.github/workflows/stable-daily.yml)` with the reason in `reason`.diff --git a/scripts/stable-daily.ts b/scripts/stable-daily.tsindex d4e05dab07..94ac02b269 100644--- a/scripts/stable-daily.ts+++ b/scripts/stable-daily.ts@@ -38,14 +38,15 @@ export const IMPORTANT_LABEL = 'stable:important';export const WEEKLY_FLOOR_DAYS = 7;/** The soak gates a scheduled promotion requires (pass === true in every cell); the latency gates stay record-only. */export const INTEGRITY_GATES = ['privacy_leaks', 'read_errors', 'version_skew', 'residents_alive', 'session_refusals'] as const;-/** The full soak a scheduled promotion requires: production-soak.yml's default cells and hours, with privacy probes run. */-export const SOAK_SHAPE = { rtts: [65, 2], hours: 2 } as const;+/** The full soak a scheduled promotion requires: production-soak.yml's default cells, hours and fixture pages, with privacy probes run. */+export const SOAK_SHAPE = { rtts: [65, 2], hours: 2, pages: 600_000 } as const;const DAY_MS = 86_400_000;const VERSION_RE = /^\d+\.\d+\.\d+(\.\d+)?$/;export interface SoakRunRow { id: number; status: string | null; conclusion: string | null; head_sha: string; html_url: string }export interface Scoreboard {label?: string; rtt_ms?: number | null; hours?: number | null; elapsed_s?: number | null; privacy?: { probes?: number };+ brain?: { fixture?: { pages?: number } } | null;gates?: Array<{ id: string; pass: boolean | null }>;}@@ -84,12 +85,13 @@ export function integrityFailures(boards: Scoreboard[]): string[] {return failures;}-/** Ways a soak falls short of the full default soak (SOAK_SHAPE): a missing cell, a short run, no privacy probes. */+/** Ways a soak falls short of the full default soak (SOAK_SHAPE): a missing cell, a short run, a small fixture, no privacy probes. */export function shapeFailures(boards: Scoreboard[]): string[] {const failures = SOAK_SHAPE.rtts.filter(rtt => !boards.some(b => b.rtt_ms === rtt)).map(rtt => `no ${rtt} ms cell`);for (const b of boards) {const cell = b.label ?? 'cell';if ((b.hours ?? 0) < SOAK_SHAPE.hours || (b.elapsed_s ?? 0) < SOAK_SHAPE.hours * 3600) failures.push(`${cell}: ran ${b.elapsed_s ?? 0} s of a ${SOAK_SHAPE.hours} h soak`);+ if ((b.brain?.fixture?.pages ?? 0) < SOAK_SHAPE.pages) failures.push(`${cell}: ${b.brain?.fixture?.pages ?? 0} fixture pages, under ${SOAK_SHAPE.pages}`);if (!((b.privacy?.probes ?? 0) > 0)) failures.push(`${cell}: no privacy probes ran`);}return failures;diff --git a/test/scripts/stable-daily.test.ts b/test/scripts/stable-daily.test.tsindex 961756ef1f..78185a1522 100644--- a/test/scripts/stable-daily.test.ts+++ b/test/scripts/stable-daily.test.ts@@ -25,7 +25,7 @@ const NOW = new Date('2026-11-10T13:17:00Z');const sha = (n: number) => String(n).padStart(40, 'c');const tree = (n: number) => String(n).padStart(40, 'e');const CLEAN: Scoreboard[] = [2, 65].map(rtt => ({- label: `rtt${rtt}`, rtt_ms: rtt, hours: 2, elapsed_s: 7204, privacy: { probes: 40 },+ label: `rtt${rtt}`, rtt_ms: rtt, hours: 2, elapsed_s: 7204, privacy: { probes: 40 }, brain: { fixture: { pages: 600_000 } },gates: ['privacy_leaks', 'read_errors', 'version_skew', 'residents_alive', 'session_refusals', 'freshness_p95'].map(id => ({ id, pass: id === 'freshness_p95' ? false : true })),}));const ok = (stdout = ''): GitResult => ({ code: 0, stdout: `${stdout}\n`, stderr: '' });@@ -173,10 +173,12 @@ describe('integrity gates', () => {expect(integrityFailures([{ label: 'rtt2', gates: [] }])).toHaveLength(5);});- test('a soak short of the full default shape is not promotable: a missing cell, a short run, no privacy probes', () => {+ test('a soak short of the full default shape is not promotable: a missing cell, a short run, a small fixture, no privacy probes', () => {expect(shapeFailures(CLEAN)).toEqual([]);const smoke: Scoreboard[] = [{ ...CLEAN[0]!, hours: 0.01, elapsed_s: 36, privacy: { probes: 0 } }];expect(shapeFailures(smoke)).toEqual(['no 65 ms cell', 'rtt2: ran 36 s of a 2 h soak', 'rtt2: no privacy probes ran']);+ const small = CLEAN.map(b => ({ ...b, brain: { fixture: { pages: 2000 } } }));+ expect(shapeFailures(small)).toEqual(['rtt2: 2000 fixture pages, under 600000', 'rtt65: 2000 fixture pages, under 600000']);});test('parseRecord reads the key: value body of a stable tag', () => {