Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(scale): f4d_sync_deadline reads the first-window watchdog notice as the extension it is
garrytana7b9c515b0e4
diff --git a/scripts/scale/f4d.ts b/scripts/scale/f4d.tsindex d5ee0620e4..bb271fe7c9 100644--- a/scripts/scale/f4d.ts+++ b/scripts/scale/f4d.ts@@ -58,6 +58,9 @@ function gitCheckout(root: string, files: number, prefix: string): void {git(['commit', '--quiet', '-m', 'f4d fixture']);}+/** The watchdog's extension notice: `still progressing` after a commit, or `before the run committed anything` inside the first progress window. */+export const deadlineExtended = (stderr: string) => stderr.includes('still progressing') || stderr.includes('before the run committed anything');+const tail = (run: Run) => `exit ${run.code}; stdout: ${run.stdout.slice(-600)} stderr: ${run.stderr.slice(-600)}`;const lastJson = (text: string) => {const line = text.trim().split('\n').reverse().find(l => l.startsWith('{'));@@ -74,7 +77,7 @@ async function syncDeadline(ctx: F4dContext): Promise<{ check: DataCheck; measur{ GBRAIN_SYNC_MAX_RUNTIME_SECONDS: '1', GBRAIN_SYNC_STALL_ABORT_SECONDS: '300' });const body = lastJson(sync.stdout);const imported = Number(body?.added ?? 0);- const extended = sync.stderr.includes('still progressing');+ const extended = deadlineExtended(sync.stderr);const problem = sync.code !== 0 ? `sync exited before finishing: ${tail(sync)}`: imported !== files ? `sync imported ${imported} of ${files} files`: !extended && sync.ms > 2000 ? 'sync outlasted its 1 s deadline without the progress-aware extension notice' : null;diff --git a/test/scripts/scale-gates.test.ts b/test/scripts/scale-gates.test.tsindex cb36e7afdb..52097a4d7b 100644--- a/test/scripts/scale-gates.test.ts+++ b/test/scripts/scale-gates.test.ts@@ -234,3 +234,11 @@ test('resultHits reads slugs from arrays and nested evidence objects', () => {expect(resultHits([{ slug: 'a', source_id: 'default' }, { results: [{ slug: 'b' }] }])).toEqual([{ slug: 'a', source_id: 'default' }, { slug: 'b' }]);expect(resultHits(null)).toEqual([]);});++test('f4d_sync_deadline reads both watchdog extension notices as extended', async () => {+ const { deadlineExtended } = await import('../../scripts/scale/f4d.ts');+ expect(deadlineExtended('[sync-watchdog] deadline reached (1s) but the run is still progressing (last progress 0s ago) — extending; it stops after 300s without progress')).toBe(true);+ expect(deadlineExtended('[sync-watchdog] deadline reached (1s) before the run committed anything; it stops as a stall unless it commits within 300s of its start')).toBe(true);+ expect(deadlineExtended('[sync-watchdog] hard deadline armed: 1s + 30s grace (env:GBRAIN_SYNC_MAX_RUNTIME_SECONDS)')).toBe(false);+ expect(deadlineExtended('[sync-watchdog] deadline reached (1s) and no progress for 300s — sending SIGTERM for graceful shutdown')).toBe(false);+});