Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(ci): nightly issue JSON block parsed without a dynamic RegExp; fix hints pass --timeout
garrytan32b563817505
diff --git a/scripts/ci-health-report.ts b/scripts/ci-health-report.tsindex 6db4182e9f..b8a56f751b 100644--- a/scripts/ci-health-report.ts+++ b/scripts/ci-health-report.ts@@ -119,7 +119,7 @@ const ratio = (n: number | null) => (n === null ? 'n/a' : n.toFixed(2));export function renderHealth(data: HealthData): string {const steps: string[] = [];- for (const f of data.failing_files.slice(0, 3)) steps.push(`Fix the flake or regression in \`${f.file}\` (${f.count} failure annotations this week); reproduce with \`bun test ${f.file}\`.`);+ for (const f of data.failing_files.slice(0, 3)) steps.push(`Fix the flake or regression in \`${f.file}\` (${f.count} failure annotations this week); reproduce with \`bun test --timeout=60000 ${f.file}\`.`);for (const w of data.workflows) {if (w.miner && (w.spread.mean_ratio ?? 0) > SPREAD_LIMIT) steps.push(`Shards in ${w.workflow} are unbalanced (mean slowest/mean ${ratio(w.spread.mean_ratio)} > ${SPREAD_LIMIT}): \`${w.miner}\`, then commit the weights.`);}diff --git a/scripts/lib/gh-issue.ts b/scripts/lib/gh-issue.tsindex 8fd092f3fc..f9a9a92804 100644--- a/scripts/lib/gh-issue.ts+++ b/scripts/lib/gh-issue.ts@@ -130,9 +130,16 @@ export async function commentIssue(client: GitHubClient, number: number, body: s/** Extract the fenced JSON block a watcher wrote between its markers; undefined when absent or not valid JSON. */export function readJsonBlock<T>(body: string | null | undefined, marker: string): T | undefined {- const m = new RegExp(`<!-- ${marker} -->\\s*\`\`\`json\\n([\\s\\S]*?)\\n\`\`\``).exec(body ?? '');- if (!m) return undefined;- try { return JSON.parse(m[1]!) as T; } catch { return undefined; }+ const text = body ?? '';+ const tag = `<!-- ${marker} -->`;+ const at = text.indexOf(tag);+ if (at === -1) return undefined;+ const rest = text.slice(at + tag.length).trimStart();+ const open = '```json\n';+ if (!rest.startsWith(open)) return undefined;+ const end = rest.indexOf('\n```', open.length - 1);+ if (end === -1) return undefined;+ try { return JSON.parse(rest.slice(open.length, end)) as T; } catch { return undefined; }}export function jsonBlock(marker: string, value: unknown): string {diff --git a/scripts/nightly-issue.ts b/scripts/nightly-issue.tsindex b21286e83b..3881a27a35 100644--- a/scripts/nightly-issue.ts+++ b/scripts/nightly-issue.ts@@ -130,7 +130,7 @@ export function validateKnownRed(text: string, todosText: string): string[] {for (const row of rows) {if (!todosText.includes(row.todo)) problems.push(`row '${row.job}': todo '${row.todo}' is not in TODOS.md; every known-red row needs the TODO that owns its fix`);}- return problems.map(p => `${KNOWN_RED_FILE}: ${p}. Fix: edit the row, then run bun test test/scripts/nightly-issue.test.ts. Docs: ${DOCS}`);+ return problems.map(p => `${KNOWN_RED_FILE}: ${p}. Fix: edit the row, then run bun test --timeout=60000 test/scripts/nightly-issue.test.ts. Docs: ${DOCS}`);}export function assessRun(run: RunInfo, jobs: JobInfo[], annotations: Record<number, Annotation[]>, rows: KnownRow[], today: string): Assessment {diff --git a/scripts/regen-all.ts b/scripts/regen-all.tsindex 97717e949e..c16aa45bf7 100644--- a/scripts/regen-all.ts+++ b/scripts/regen-all.ts@@ -54,8 +54,8 @@ export const CONTRACT_GOLDENS = [/** Goldens that need a Postgres database; never run here. */export const POSTGRES_GOLDENS = [- 'GBRAIN_TEST_UPDATE_GOLDENS=1 DATABASE_URL=<test db> bun test test/e2e/schema-catalog-golden.test.ts',- 'GBRAIN_TEST_UPDATE_GOLDENS=1 DATABASE_URL=<test db> bun test test/e2e/doctor-json-golden.test.ts',+ 'GBRAIN_TEST_UPDATE_GOLDENS=1 DATABASE_URL=<test db> bun test --timeout=60000 test/e2e/schema-catalog-golden.test.ts',+ 'GBRAIN_TEST_UPDATE_GOLDENS=1 DATABASE_URL=<test db> bun test --timeout=60000 test/e2e/doctor-json-golden.test.ts',];const ROOT = resolve(import.meta.dir, '..');diff --git a/test/scripts/regen-all.test.ts b/test/scripts/regen-all.test.tsindex 1cb4c13a46..f124b99f31 100644--- a/test/scripts/regen-all.test.ts+++ b/test/scripts/regen-all.test.ts@@ -36,7 +36,7 @@ describe('regen:all', () => {}expect(ARTIFACTS.at(-1)!.name).toContain('llms');for (const f of CONTRACT_GOLDENS) expect(existsSync(join(ROOT, f)), f).toBe(true);- for (const c of POSTGRES_GOLDENS) expect(existsSync(join(ROOT, /bun test (\S+)/.exec(c)![1]!)), c).toBe(true);+ for (const c of POSTGRES_GOLDENS) expect(existsSync(join(ROOT, /bun test (?:--timeout=\d+ )?(\S+)/.exec(c)![1]!)), c).toBe(true);});test('generators run without provider keys or database URLs', () => {