Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

nightly-watch: drop the PGLite 20k known-red row; the cell is green

garrytance1b7748c0f8
diff --git a/.github/nightly-known-red.tsv b/.github/nightly-known-red.tsv
index c99f277bab..8f266bdc99 100644
--- a/.github/nightly-known-red.tsv
+++ b/.github/nightly-known-red.tsv
@@ -10,5 +10,4 @@
# kind known-red | known-skipped
# todo the TODOS.md entry title that owns the fix (must appear in TODOS.md)
# review_by YYYY-MM-DD; after it the incident asks for a fix or a re-justified date
-Scale tier scale pglite 20000 phase watchdog: vectors known-red PGLite bulk-embedding cliff at ~20k chunks 2026-10-25
Heavy Tests Hermes door e2e (credentialed, real binary, loud-fail) Run hermes door tests known-skipped Set the ANTHROPIC_API_KEY and OPENAI_API_KEY repo secrets 2026-10-18
diff --git a/TODOS.md b/TODOS.md
index 5cd559afdc..18415220a2 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -2,10 +2,10 @@
## Test, eval and CI fix wave follow-ups (filed 2026-10-04, GBRA-47)
-Context: `.github/nightly-known-red.tsv` rows point here; nightly-watch keeps their incidents open until the row is deleted.
+Context: `.github/nightly-known-red.tsv` rows point here; nightly-watch keeps their incidents open until the row is deleted. Scale-tier evidence: per-batch `vectors` lines and the phase watchdog in `scripts/scale/`.
-- [ ] **P1 — PGLite bulk-embedding cliff at ~20k chunks.**
- **What:** the scale tier's PGLite 20k cell stalled in the `vectors` phase (batched `UPDATE content_chunks SET embedding`) for 36+ minutes on nightly run 37196223708, while Postgres finished the same phase in 42 s. **Why:** a default PGLite brain that embeds ~20k chunks at once may hit the same wall. **Fix:** measure through the shipped `gbrain embed` path and the per-batch `vectors` progress lines (batch time, RSS, dimension) on the next 20k runs, then decide the engine fix (HNSW maintenance around bulk updates, PGLite memory settings). The phase watchdog names the stall meanwhile. **Effort:** M. **Priority:** P1.
+- [ ] **P2 — PGLite bulk-embedding cost at 20k+ chunks.**
+ **What:** the 36-minute PGLite `vectors` stall at 20k pages (nightly run 37196223708) no longer reproduces with the WAL checkpoint guard on autocommit writes: branch dispatch 37221090928 finished PGLite 20k `vectors` in 173 s (40 batches of 500 pages, dimension 1024, RSS ~2.5 GiB), against 56 s on Postgres. Per-batch time still grows from 2.1 s to 6.3 s across the phase. **Why:** a default PGLite brain that embeds 50k+ chunks at once may hit the superlinear part. **Fix:** read the per-batch `vectors` lines on the 50k promotion runs; if the batch time keeps climbing, measure through the shipped `gbrain embed` path and decide the engine fix (HNSW maintenance around bulk updates, PGLite memory settings). **Effort:** M. **Priority:** P2.
- [ ] **P1 — Set the ANTHROPIC_API_KEY and OPENAI_API_KEY repo secrets.**
**What:** the Hermes door's paid leg and the real-agent Claude/Codex doors skip visibly every night because both secrets are empty (approved, decision D-1). **Why:** only the repo owner can set secrets. **Fix:** `gh secret set ANTHROPIC_API_KEY` and `gh secret set OPENAI_API_KEY`, then delete the Heavy Tests row from `.github/nightly-known-red.tsv`. **Effort:** S. **Priority:** P1.
diff --git a/scripts/scale/watchdog.ts b/scripts/scale/watchdog.ts
index 0df14b2695..4092fb43ff 100644
--- a/scripts/scale/watchdog.ts
+++ b/scripts/scale/watchdog.ts
@@ -32,7 +32,8 @@ const COVERS: Record<string, WatchedPhase[]> = {
ops: ['budgets'], reimport: ['budgets'], cold_query: ['budgets'], writers: ['budgets'],
};
export const WATCHDOG_GRACE = 1.5;
-export const X5_TODO = 'TODOS.md "PGLite bulk-embedding cliff at ~20k chunks" (X5)';
+export const X5_TODO_TITLE = 'PGLite bulk-embedding cost at 20k+ chunks';
+export const X5_TODO = `TODOS.md "${X5_TODO_TITLE}" (X5)`;
export const HOME_LINE = '[scale] brain home: ';
export const DATABASE_LINE = '[scale] scale database: ';
@@ -61,7 +62,7 @@ export function watchdogDiagnostic(phase: WatchedPhase, elapsedMs: number, limit
`[scale] FAIL phase watchdog: ${phase} ran ${Math.round(elapsedMs / 1000)} s, limit ${Math.round(limitMs / 1000)} s; the harness was killed (exit 1).`,
`[scale] last progress line: ${lastLine || '(none)'}`,
`[scale] Why: a phase past its watchdog limit (${WATCHDOG_GRACE}x its gate ceiling unless overridden) is a stall, and an in-process timer cannot fire while PGLite blocks the main thread.`,
- `[scale] Known issue: ${X5_TODO} tracks the PGLite vectors stall at 20k pages.`,
+ `[scale] Known issue: ${X5_TODO} tracks PGLite bulk-embedding cost and the 20k vectors stall history.`,
`[scale] Fix: profile the named phase; to let it run longer locally, set ${overrideVariable(phase)}=<ms> and rerun: ${reproduce}`,
].join('\n');
}
diff --git a/test/scripts/nightly-issue.test.ts b/test/scripts/nightly-issue.test.ts
index c81cced1eb..ba421ab73d 100644
--- a/test/scripts/nightly-issue.test.ts
+++ b/test/scripts/nightly-issue.test.ts
@@ -49,6 +49,8 @@ const heavy = () => ({
annotations: Object.fromEntries([111415376248, 111415376292, 111415376359].map(id => [id, load<unknown[]>(`annotations-${id}.json`)])),
});
const realRows = parseKnownRed(readFileSync(join(ROOT, '.github/nightly-known-red.tsv'), 'utf8')).rows;
+const scaleRow: KnownRow = { workflow: 'Scale tier', job: 'scale pglite 20000', signature: 'phase watchdog: vectors', kind: 'known-red', todo: 'PGLite bulk-embedding cost at 20k+ chunks', review_by: '2026-10-25' };
+const scaleRows = [...realRows, scaleRow];
const recordOf = (body: unknown) => readJsonBlock<IncidentRecord>(String(body), JSON_MARKER)!;
const issueWith = (state: 'open' | 'closed', record: Partial<IncidentRecord>, labels = ['nightly-red']): Issue => ({
number: 7, title: 'Nightly red: Heavy Tests', state, labels: labels.map(name => ({ name })),
@@ -130,18 +132,18 @@ describe('nightly-watch incidents', () => {
test('a failure matching a known-red row is tracked (known-red label, no comment when unchanged); new error text in the same job is a new incident', async () => {
const watchdog = '[scale] FAIL phase watchdog: vectors ran 676 s, limit 675 s; the harness was killed (exit 1).';
const first = fakeClient(scaleRun(watchdog));
- const known = await watchRun({ client: first.client, repo: REPO, runId: 1, rows: realRows, today: TODAY, dryRun: false });
+ const known = await watchRun({ client: first.client, repo: REPO, runId: 1, rows: scaleRows, today: TODAY, dryRun: false });
expect(known.assessment.state).toBe('known-red');
expect(known.plan.labels).toEqual(['nightly-red', 'known-red']);
expect(known.plan.record!.next_step).toBe('known_red_wait');
expect(known.plan.record!.dispatch_argv).toEqual(['gh', 'workflow', 'run', 'scale-tier.yml', '--ref', 'master', '-f', 'pages=20000']);
const unchanged = fakeClient({ ...scaleRun(watchdog), issues: [{ ...issueWith('open', known.plan.record!, ['nightly-red', 'known-red']), title: 'Nightly red: Scale tier' }] });
- await watchRun({ client: unchanged.client, repo: REPO, runId: 1, rows: realRows, today: TODAY, dryRun: false });
+ await watchRun({ client: unchanged.client, repo: REPO, runId: 1, rows: scaleRows, today: TODAY, dryRun: false });
expect(unchanged.calls.some(c => c.path.endsWith('/comments'))).toBe(false);
const other = fakeClient(scaleRun('[scale] FAIL find_orphans: an island page is missing'));
- const fresh = await watchRun({ client: other.client, repo: REPO, runId: 1, rows: realRows, today: TODAY, dryRun: false });
+ const fresh = await watchRun({ client: other.client, repo: REPO, runId: 1, rows: scaleRows, today: TODAY, dryRun: false });
expect(fresh.assessment.state).toBe('red');
expect(fresh.plan.labels).toEqual(['nightly-red']);
});
@@ -150,14 +152,14 @@ describe('nightly-watch incidents', () => {
const watchdog = '[scale] FAIL phase watchdog: vectors ran 676 s';
const late = '2026-11-01';
const first = fakeClient(scaleRun(watchdog));
- const created = await watchRun({ client: first.client, repo: REPO, runId: 1, rows: realRows, today: late, dryRun: false });
+ const created = await watchRun({ client: first.client, repo: REPO, runId: 1, rows: scaleRows, today: late, dryRun: false });
expect(created.plan.record!.next_step).toBe('review_by_passed');
const before = { ...created.plan.record!, review_by_notified: [] };
const open = fakeClient({ ...scaleRun(watchdog), issues: [{ ...issueWith('open', before, ['nightly-red', 'known-red']), title: 'Nightly red: Scale tier' }] });
- const notified = await watchRun({ client: open.client, repo: REPO, runId: 1, rows: realRows, today: late, dryRun: false });
+ const notified = await watchRun({ client: open.client, repo: REPO, runId: 1, rows: scaleRows, today: late, dryRun: false });
expect(String(open.calls.find(c => c.path.endsWith('/comments'))!.body!.body)).toContain('Review-by date passed');
const quiet = fakeClient({ ...scaleRun(watchdog), issues: [{ ...issueWith('open', notified.plan.record!, ['nightly-red', 'known-red']), title: 'Nightly red: Scale tier' }] });
- await watchRun({ client: quiet.client, repo: REPO, runId: 1, rows: realRows, today: late, dryRun: false });
+ await watchRun({ client: quiet.client, repo: REPO, runId: 1, rows: scaleRows, today: late, dryRun: false });
expect(quiet.calls.some(c => c.path.endsWith('/comments'))).toBe(false);
});
@@ -202,7 +204,7 @@ describe('nightly-watch incidents', () => {
describe('.github/nightly-known-red.tsv', () => {
const todos = readFileSync(join(ROOT, 'TODOS.md'), 'utf8');
const header = '# Columns: workflow, job, signature, kind, todo, review_by\n';
- const row = (r: Partial<KnownRow> = {}) => [r.workflow ?? 'W', r.job ?? 'j', r.signature ?? 's', r.kind ?? 'known-red', r.todo ?? 'PGLite bulk-embedding cliff at ~20k chunks', r.review_by ?? '2026-10-25'].join('\t');
+ const row = (r: Partial<KnownRow> = {}) => [r.workflow ?? 'W', r.job ?? 'j', r.signature ?? 's', r.kind ?? 'known-red', r.todo ?? 'Set the ANTHROPIC_API_KEY and OPENAI_API_KEY repo secrets', r.review_by ?? '2026-10-25'].join('\t');
test('the committed file is valid: at most 3 rows, ISO review-by dates, each TODO present in TODOS.md', () => {
expect(validateKnownRed(readFileSync(join(ROOT, '.github/nightly-known-red.tsv'), 'utf8'), todos)).toEqual([]);
diff --git a/test/scripts/scale-watchdog.test.ts b/test/scripts/scale-watchdog.test.ts
index b23dad1d92..dc7aed836a 100644
--- a/test/scripts/scale-watchdog.test.ts
+++ b/test/scripts/scale-watchdog.test.ts
@@ -5,10 +5,10 @@
* the X5 TODO and the override variable.
*/
import { describe, expect, test } from 'bun:test';
-import { existsSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
+import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
-import { superviseScaleRun, watchdogLimitsMs, type WatchedPhase } from '../../scripts/scale/watchdog.ts';
+import { X5_TODO_TITLE, superviseScaleRun, watchdogLimitsMs, type WatchedPhase } from '../../scripts/scale/watchdog.ts';
const HOUR = 3_600_000;
const limits = (vectors: number): Record<WatchedPhase, number> => ({ import: HOUR, extract: HOUR, vectors, budgets: HOUR });
@@ -55,7 +55,8 @@ describe('scale phase watchdog', () => {
expect(diagnostic).toContain('FAIL phase watchdog: vectors ran');
expect(diagnostic).toContain('limit 2 s');
expect(diagnostic).toContain('last progress line: [scale] vectors batch 3/40: 500 pages in 12 ms');
- expect(diagnostic).toContain('PGLite bulk-embedding cliff at ~20k chunks" (X5)');
+ expect(diagnostic).toContain(`TODOS.md "${X5_TODO_TITLE}" (X5)`);
+ expect(readFileSync(join(import.meta.dir, '../../TODOS.md'), 'utf8')).toContain(X5_TODO_TITLE);
expect(diagnostic).toContain('GBRAIN_SCALE_PHASE_LIMIT_MS_VECTORS=<ms>');
expect(diagnostic).toContain('bun run test:scale -- --pages 20000');
const output = lines.join('');