Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(decide): wait for the late intent receipt so it cannot land in the next test's count (serial-tests flake)
garrytan65264ae4c1a9
diff --git a/test/decide/retrieval-think.serial.test.ts b/test/decide/retrieval-think.serial.test.tsindex a7e4d49f2e..93d8cb5b0d 100644--- a/test/decide/retrieval-think.serial.test.ts+++ b/test/decide/retrieval-think.serial.test.ts@@ -12,6 +12,7 @@* Serial: mutates GBRAIN_HOME and the process-global gateway.*/import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';+import { waitFor } from '../helpers/wait-for.ts';import { mkdtempSync, rmSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';@@ -159,6 +160,9 @@ describe('S2 in think', () => {__setDecideTransportForTests(async () => new Response('x', { status: 503 }));const failed = await startThinkDecide(engine, { question: 'alpha keyword', remote: false }, 'temporal');expect(await failed!.trajectoryIntent('temporal')).toBe('temporal');+ // The late answer still lands after the test body returns; wait for its+ // receipt so it cannot leak into the next test's receipt count.+ await waitFor(async () => (await receipts()).some((r) => r.error_reason === 'late'), { label: 'late intent receipt' });});test('all-off: no decide work at all', async () => {