Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: reset the CLI exit verdict after the thin-client forget refusal and secret-surface CLI captures (leaked into connectors-sync-cli)
garrytan89e91e050a6d
diff --git a/test/source-config-secret-surfaces.test.ts b/test/source-config-secret-surfaces.test.tsindex 5be7db4e4f..e7607e28a7 100644--- a/test/source-config-secret-surfaces.test.ts+++ b/test/source-config-secret-surfaces.test.ts@@ -12,6 +12,7 @@* `sources webhook rotate`, must print the NEW secret exactly once.*/import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';+import { _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';import { randomUUID } from 'node:crypto';import { execFileSync } from 'node:child_process';import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';@@ -106,6 +107,8 @@ async function captureCli(fn: () => Promise<unknown>): Promise<string> {} finally {console.log = saved.log; console.error = saved.error; console.warn = saved.warn; console.info = saved.info;(process as { exit: unknown }).exit = saved.exit;+ _resetCliExitVerdictForTests();+ process.exitCode = 0;}return lines.join('\n');}diff --git a/test/thin-client-routing-audit.test.ts b/test/thin-client-routing-audit.test.tsindex 081f6df388..170b2eb18b 100644--- a/test/thin-client-routing-audit.test.ts+++ b/test/thin-client-routing-audit.test.ts@@ -86,7 +86,7 @@ describe('thin-client routing audit — ROUTE additions call the remote op', ()try {await thinClient(() => runForget(async () => { throw new Error('local engine opened'); },['42', '--source', 'notes', '--request-id', requestId, '--json']));- } finally { final.mockRestore(); process.exitCode = priorExitCode ?? 0; }+ } finally { final.mockRestore(); cliForceExit._resetCliExitVerdictForTests(); process.exitCode = priorExitCode ?? 0; }expect(calls).toEqual([]);const envelope = JSON.parse(docs.join(''));expect(envelope).toMatchObject({ code: 'invalid_params', fix: { argv: ['gbrain', 'forget', '42', '--request-id', requestId], next: 'run' } });