Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(closeout): think's keyless stub over HTTP names no key or provider posture
garrytan66ea84d0ab76
diff --git a/src/core/ops/takes.ts b/src/core/ops/takes.tsindex 7cc30e39a0..0395cb51e0 100644--- a/src/core/ops/takes.ts+++ b/src/core/ops/takes.ts@@ -251,6 +251,15 @@ const think: Operation = {remote: ctx.remote !== false, // fail-closed: anything not strictly false is untrusted (CLAUDE.md invariant)}).catch((e: unknown) => { throw thinkModelError(ctx, e); });result.answer = result.answer.replace(' or pass `client`', ' on the brain host');+ if (ctx.transport === 'http' && (result.synthesis_status === 'no_llm' || result.synthesis_status === 'model_unusable')) {+ // A6 HTTP view: a remote caller is never told the host's key names or provider posture. The stub+ // answer and gaps are prose for the operator; synthesis_status and the warning codes stay as data.+ const { redactForTransport } = await import('../agent-output.ts');+ result.answer = result.synthesis_status === 'no_llm'+ ? '(no LLM available on the brain host — the gathered evidence is returned without a synthesized answer)'+ : redactForTransport(result.answer, 'http');+ result.gaps = redactForTransport(result.gaps, 'http');+ }// Persist if --save was passed locallylet savedSlug: string | undefined;diff --git a/test/agent-injection-http-view.serial.test.ts b/test/agent-injection-http-view.serial.test.tsindex e5760d433f..86d9e70c38 100644--- a/test/agent-injection-http-view.serial.test.ts+++ b/test/agent-injection-http-view.serial.test.ts@@ -250,6 +250,8 @@ describe('a real gbrain serve --http session', () => {['unknown tool', await call(admin, 'no_such_tool_x')],['scope denial', await call(reader, 'put_page', { slug: 'notes/x', content: 'x' })],['think keyless notices', noticesOf(await call(admin, 'think', { question: 'what is in the teapot inventory?' }))],+ // The whole keyless think result, body included: the stub answer names no key or provider posture.+ ['think keyless body', await call(admin, 'think', { question: 'what is in the teapot inventory?' })],];for (const [what, out] of outputs) {const text = JSON.stringify(out);