Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(cli-socket): the serve-timeout context test gates SQL and installs capture, so the frame's source is null whatever ran first
garrytan7b573e57eabe
diff --git a/test/cli-socket-context.test.ts b/test/cli-socket-context.test.tsindex 33a7e1a127..3fbab1d22f 100644--- a/test/cli-socket-context.test.ts+++ b/test/cli-socket-context.test.ts@@ -20,6 +20,7 @@ import { cliSocketIdentity } from '../src/core/cli-socket/identity.ts';import { resetPgliteState } from './helpers/reset-pglite.ts';import { withEnv } from './helpers/with-env.ts';import { serializeOperationError, warmRoundTripTimeout } from '../src/core/cli-socket/protocol.ts';+import { installOutputCapture } from '../src/core/cli-socket/output-capture.ts';let engine: PGLiteEngine;const op = { params: {} };@@ -72,14 +73,18 @@ describe('cliRequestContext mirrors makeContext', () => {});test('a serve-side timeout answers a retryable timeout error (no cold rerun) while the work keeps the request active until it settles', async () => {- // Config reads wait on a gate, so the request is still working when its deadline passes. A bare short deadline- // is not enough: PGLite can finish the whole search before the timer gets a turn (stress gate, seed 193478).+ // Config reads and SQL wait on a gate, so the request is still working when its deadline passes. A bare short+ // deadline is not enough: PGLite can finish the whole search before the timer gets a turn (stress gate, seed+ // 193478). The capture is installed as the serve installs it (process-global, so an earlier test in the same+ // process may already have done it), and with SQL gated the source resolution cannot finish first: the+ // timeout frame carries no resolved source whatever ran before this test.+ installOutputCapture();let release!: () => void;const gate = new Promise<void>(resolve => { release = resolve; });const gated = new Proxy(engine, {get(target, key) {const value = Reflect.get(target, key, target);- if (key === 'getConfig' || key === 'getAllConfig') return async (...args: unknown[]) => { await gate; return (value as (...a: unknown[]) => unknown).apply(target, args); };+ if (key === 'getConfig' || key === 'getAllConfig' || key === 'executeRaw') return async (...args: unknown[]) => { await gate; return (value as (...a: unknown[]) => unknown).apply(target, args); };return typeof value === 'function' ? value.bind(target) : value;},});