Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(lane-h): gbrain call caller mistakes exit 2 without changing the write lane; mount refusal names the list command
garrytan7d16702bd435
diff --git a/src/commands/call.ts b/src/commands/call.tsindex 6f4a03ee93..54cec655db 100644--- a/src/commands/call.ts+++ b/src/commands/call.ts@@ -85,9 +85,7 @@ export async function runCall(return;}} catch (error) {- // A delegated call's caller mistake (e.g. invalid params) gets the same v1 envelope and exit as the direct path.- if (!writePathFailure(error)) return failCall(tool, error, out);- if (await reportPersistenceCliError(error, true, out)) return;+ if (await reportPersistenceCliError(error, true, out)) return usageVerdict(error);throw error;}try {@@ -113,11 +111,19 @@ export async function runCall(// its tail to the exit grace under queued stdout writes.await out(JSON.stringify(result, bigintToStringReplacer, 2) + '\n');} catch (error) {- if (writePathFailure(error) && await reportPersistenceCliError(error, true, out)) return;+ if (writePathFailure(error) && await reportPersistenceCliError(error, true, out)) return usageVerdict(error);await failCall(tool, error, out);}}+/**+ * A3 on `gbrain call`: a caller mistake refused before any write was admitted+ * (no receipt) is invalid input, exit 2, even when the write lane rendered it.+ */+function usageVerdict(error: unknown): void {+ if (error instanceof OperationError && error.code === 'invalid_params' && error.writeRequest === undefined) setCliExitVerdict(2);+}+/*** Agent contract v1 (A1): `gbrain call` is a JSON surface, so a failure is* the same envelope an MCP caller gets, on stdout, with the registry's exit.diff --git a/src/core/persistence/local-client.ts b/src/core/persistence/local-client.tsindex b50737f1c4..e0c4b40c7c 100644--- a/src/core/persistence/local-client.ts+++ b/src/core/persistence/local-client.ts@@ -37,7 +37,7 @@ export function persistenceConfigForBrain(const mount = mounts.find(candidate => candidate.id === brainId || candidate.alias === brainId);if (!mount || mount.enabled === false) {throw opError('invalid_params', `Brain '${brainId}' is not an enabled mount.`,- 'Pass --brain host or the id or alias of an enabled mount; re-enabling a disabled mount is the user\'s call.',+ 'Pass --brain host or the id or alias of an enabled mount (`gbrain mounts list --json` shows them); re-enabling a disabled mount is the user\'s call.',{ fix: readFix('Lists mounted brains with their ids, aliases and enabled state.', { argv: ['gbrain', 'mounts', 'list', '--json'] }) });}return { engine: mount.engine, database_path: mount.database_path, database_url: mount.database_url } as GBrainConfig;