Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix: thin-client routed remember batch failure names its command and exits 1
garrytanf5a7d8e77500
diff --git a/src/cli/main.ts b/src/cli/main.tsindex 3f0b2324a1..57639fe439 100755--- a/src/cli/main.ts+++ b/src/cli/main.ts@@ -853,7 +853,7 @@ async function runThinClientRouted(// GST-1387: an in-band failure (a remember batch with a failed item) exits 1 here too, as on the local path.if (typeof result === 'object' && result !== null && !Array.isArray(result) && (result as { status?: unknown }).status === 'error') {const detail = (result as { message?: unknown; error?: unknown }).message ?? (result as { error?: unknown }).error;- console.error(`gbrain ${command}: operation reported status 'error'` + (typeof detail === 'string' && detail ? ` — ${detail}` : '') + '.');+ console.error(`gbrain ${op.cliHints?.name ?? op.name}: operation reported status 'error'` + (typeof detail === 'string' && detail ? ` — ${detail}` : '') + '.');setCliExitVerdict(1);}markEntityMiss(op.name, result);diff --git a/test/agent-error-surfaces.serial.test.ts b/test/agent-error-surfaces.serial.test.tsindex 143931cf68..d9e2e34d01 100644--- a/test/agent-error-surfaces.serial.test.ts+++ b/test/agent-error-surfaces.serial.test.ts@@ -488,5 +488,14 @@ describe('#8621: a partly failed remember batch over HTTP and the thin client',expect(JSON.parse(http.content[0]!.text!)).toMatchObject({ status: 'error', saved: 1, items: [{ status: 'failed' }, { status: 'inserted', id: 7 }] });const remote = await withOpHandler('remember', handler, () => callRemoteTool(thinClientConfig(serve, oauth), 'remember', args, { timeoutMs: 30_000 }));expect(unpackToolResult(remote)).toMatchObject({ status: 'error', saved: 1, items: [{ status: 'failed' }, { status: 'inserted', id: 7 }] });- }, 60_000);+ const homeT = mkdtempSync(join(tmpdir(), 'gbrain-8621-thin-'));+ try {+ mkdirSync(join(homeT, '.gbrain'), { recursive: true });+ writeFileSync(join(homeT, '.gbrain', 'config.json'), JSON.stringify(thinClientConfig(serve, oauth)));+ const cli = await withOpHandler('remember', handler, () => gbrain(homeT, ['remember', '--items', JSON.stringify(args.items), '--provenance', 'test']));+ expect({ exitCode: cli.exitCode, stderr: cli.stderr }).toMatchObject({ exitCode: 1, stderr: expect.stringContaining("gbrain remember: operation reported status 'error'") });+ expect(cli.stdout).toContain('saved 1 of 2 fact(s), 1 failed');+ expect(cli.stdout).toContain('items[1]: inserted (fact #7)');+ } finally { rmSync(homeT, { recursive: true, force: true }); }+ }, 120_000);});