Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(recall): await the async recall render after merging the warm CLI socket

garrytane131d9080652
diff --git a/src/cli/cli-socket-client.ts b/src/cli/cli-socket-client.ts
index 64a9e0c0b0..06625ae85d 100644
--- a/src/cli/cli-socket-client.ts
+++ b/src/cli/cli-socket-client.ts
@@ -240,7 +240,7 @@ export async function maybeServeFromCliSocket(command: string, args: string[]):
const { writeCliNotices } = await import('../core/interop-notices.ts');
const rendered = await buffered(async () => {
if (frame.kind === 'error') { await recall.reportOneShotRecallError(reviveOperationError(frame.error), flags); return; }
- recall.renderRecallVerbResult(flags, frame.result as Parameters<typeof recall.renderRecallVerbResult>[1]);
+ await recall.renderRecallVerbResult(flags, frame.result as Parameters<typeof recall.renderRecallVerbResult>[1]);
if (frame.notices.length > 0) writeCliNotices(frame.notices);
});
if ('error' in rendered) return renderFailed(rendered.error);
diff --git a/src/commands/recall.ts b/src/commands/recall.ts
index c7aeada771..95d1bda0d6 100644
--- a/src/commands/recall.ts
+++ b/src/commands/recall.ts
@@ -336,7 +336,7 @@ export async function runRecall(engine: BrainEngine, args: string[]): Promise<vo
const flags = parseFlags(args);
if (isOneShotRecall(flags)) {
try {
- renderRecallVerbResult(flags, await oneShotRecallResult(engine, flags));
+ await renderRecallVerbResult(flags, await oneShotRecallResult(engine, flags));
} catch (error) {
await reportOneShotRecallError(error, flags);
}
@@ -359,7 +359,7 @@ export async function runRecall(engine: BrainEngine, args: string[]): Promise<vo
// MEMORY_VERBS v1 [c4]: the verb params route through the recall OP so the
// CLI and MCP exercise the same arm (query/budget packing/superset envelope).
if (flags.query !== null || flags.budgetTokens !== null || flags.question !== null) {
- renderRecallVerbResult(flags, await recallVerbResult(engine, flags, sourceId));
+ await renderRecallVerbResult(flags, await recallVerbResult(engine, flags, sourceId));
return;
}
@@ -496,7 +496,7 @@ async function recallVerbResult(engine: BrainEngine, flags: ParsedFlags, sourceI
: await op.handler(ctx, params)) as RecallVerbResult;
}
-export function renderRecallVerbResult(flags: ParsedFlags, result: RecallVerbResult): void {
+export async function renderRecallVerbResult(flags: ParsedFlags, result: RecallVerbResult): Promise<void> {
// An older server ignores `question` (warn-mode params) and answers without facts_order.
const unranked = flags.question !== null && result.facts_order !== 'relevance'
? 'note: this brain did not rank facts by the question (its server predates question ranking); facts are newest first.' : null;
@@ -570,7 +570,7 @@ async function keylessQuestionFallback(engine: BrainEngine, flags: ParsedFlags,
}
process.stderr.write(`[recall] no entity or fact text matched '${question}'; ranked facts by relevance to it as a question (keyword-only: this brain has no embeddings).\n`);
const questionFlags = { ...flags, entity: null, question };
- renderRecallVerbResult(questionFlags, await recallVerbResult(engine, questionFlags, sourceId));
+ await renderRecallVerbResult(questionFlags, await recallVerbResult(engine, questionFlags, sourceId));
return true;
}