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.
This commit is contained in:
kenantan32
2026-03-23 15:49:38 +08:00
committed by Peter Steinberger
parent 9f8c4efa9b
commit 7c8d75e3d6

View File

@@ -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);