Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test: trust-owner-actions and repair-conversation-labels clear the CLI exit verdict they set, so later tests in the shard read 0 (#2084 owned verdict)
garrytan0d8d495ae33c
diff --git a/test/repair-conversation-labels.test.ts b/test/repair-conversation-labels.test.tsindex 405334eb76..33be433b18 100644--- a/test/repair-conversation-labels.test.ts+++ b/test/repair-conversation-labels.test.ts@@ -20,6 +20,7 @@* Seams: pre-fix rows are seeded with the extractor's provenance (no* gateway), extraction runs the Core with an injected extractor.*/+import { _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';import { afterAll, beforeAll, beforeEach, expect, test } from 'bun:test';import type { BrainEngine } from '../src/core/engine.ts';import { PGLiteEngine } from '../src/core/pglite-engine.ts';@@ -91,7 +92,7 @@ async function capture(run: () => Promise<unknown>): Promise<{ out: string; exitconsole.error = () => {};process.stdout.write = ((chunk: string | Uint8Array) => { lines.push(String(chunk)); return true; }) as typeof process.stdout.write;try { await run(); return { out: lines.join('\n'), exitCode: process.exitCode }; }- finally { console.log = log; console.error = error; process.stdout.write = stdout; process.exitCode = previous ?? 0; }+ finally { console.log = log; console.error = error; process.stdout.write = stdout; process.exitCode = previous ?? 0; _resetCliExitVerdictForTests(); }}async function repair(engine: BrainEngine, args: string[]): Promise<RepairJson> {const { out } = await capture(() => runRepairCommand(engine, ['conversation-labels', ...args, '--json']));diff --git a/test/trust-owner-actions.test.ts b/test/trust-owner-actions.test.tsindex 4121a1a229..02ddb4d146 100644--- a/test/trust-owner-actions.test.ts+++ b/test/trust-owner-actions.test.ts@@ -16,6 +16,7 @@* insufficient_scope, a stale approval applies, or the listing drifts.* Runs on PGLite, and on Postgres when DATABASE_URL is set.*/+import { _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';import { afterAll, afterEach, beforeAll, describe, expect, test } from 'bun:test';import { randomUUID } from 'node:crypto';import { mkdtempSync, readFileSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';@@ -452,7 +453,7 @@ describe('review, explain and accept-all (CEO-2, DX-10, DX-15, DX-16)', () => {nonTty();await runTrustOwnerCommand(localTrustBackend(engine), 'review', ['--accept-all']);await runTrustOwnerCommand(localTrustBackend(engine), 'review', ['--accept-all', '--from', b.sourceId]);- } finally { process.stderr.write = original; process.exitCode = 0; }+ } finally { process.stderr.write = original; process.exitCode = 0; _resetCliExitVerdictForTests(); }expect(errors.join('\n')).toContain('needs at least one filter');expect(errors.join('\n')).toContain('confirmation_required');expect((await pageRow(b, 'notes/bulk-example')).trust_tier).toBe('agent_written');@@ -540,7 +541,7 @@ describe('aliases (DX-7)', () => {const error = console.error;process.stderr.write = ((chunk: string | Uint8Array) => { out.push(String(chunk)); return true; }) as typeof process.stderr.write;console.error = (...args: unknown[]) => { out.push(args.join(' ')); };- try { return { result: await fn(), stderr: out.join('\n') }; } finally { process.stderr.write = write; console.error = error; process.exitCode = 0; }+ try { return { result: await fn(), stderr: out.join('\n') }; } finally { process.stderr.write = write; console.error = error; process.exitCode = 0; _resetCliExitVerdictForTests(); }};test('quarantine release|drop print the canonical trust form and run the same checks', async () => withEnv({ GBRAIN_HOME: home }, async () => {