From 7c8d75e3d694d149e4bdf1e0e8f5643bbf8a52ae Mon Sep 17 00:00:00 2001 From: kenantan32 Date: Mon, 23 Mar 2026 15:49:38 +0800 Subject: [PATCH] fix: preserve CLI session ID in text output mode When the CLI backend output mode is "text", sessionId was hardcoded to undefined. This caused the fallback chain to store the OpenClaw internal UUID as the CLI session ID. On resume, --resume was called with the wrong UUID, resulting in "No conversation found with session ID". Return resolvedSessionId instead of undefined so the correct CLI session ID is persisted and resume works correctly. --- src/agents/cli-runner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/agents/cli-runner.ts b/src/agents/cli-runner.ts index 21d7d71cf5b..55a2d2ad803 100644 --- a/src/agents/cli-runner.ts +++ b/src/agents/cli-runner.ts @@ -422,7 +422,7 @@ export async function runCliAgent(params: { const outputMode = useResume ? (backend.resumeOutput ?? backend.output) : backend.output; if (outputMode === "text") { - return { text: stdout, sessionId: undefined }; + return { text: stdout, sessionId: resolvedSessionId }; } if (outputMode === "jsonl") { const parsed = parseCliJsonl(stdout, backend);