mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 21:01:26 +00:00
Fix test corrupting production sessions.json
The test 'falls back to most recent session when no to is provided' was using resolveStorePath() which returns the real ~/.warelay/sessions.json. This overwrote production session data with test values, causing session fragmentation issues. Changed to use a temp directory like other tests.
This commit is contained in:
@@ -259,8 +259,11 @@ export async function runCommandReply(
|
||||
console.error(
|
||||
`Command auto-reply exited with code ${code ?? "unknown"} (signal: ${signal ?? "none"})`,
|
||||
);
|
||||
// Include any partial output or stderr in error message
|
||||
const partialOut = trimmed ? `\n\nOutput: ${trimmed.slice(0, 500)}${trimmed.length > 500 ? "..." : ""}` : "";
|
||||
const errorText = `⚠️ Command exited with code ${code ?? "unknown"}${signal ? ` (${signal})` : ""}${partialOut}`;
|
||||
return {
|
||||
payload: undefined,
|
||||
payload: { text: errorText },
|
||||
meta: {
|
||||
durationMs: Date.now() - started,
|
||||
queuedMs,
|
||||
@@ -278,8 +281,9 @@ export async function runCommandReply(
|
||||
console.error(
|
||||
`Command auto-reply process killed before completion (exit code ${code ?? "unknown"})`,
|
||||
);
|
||||
const errorText = `⚠️ Command was killed before completion (exit code ${code ?? "unknown"})`;
|
||||
return {
|
||||
payload: undefined,
|
||||
payload: { text: errorText },
|
||||
meta: {
|
||||
durationMs: Date.now() - started,
|
||||
queuedMs,
|
||||
@@ -379,8 +383,11 @@ export async function runCommandReply(
|
||||
};
|
||||
}
|
||||
logError(`Command auto-reply failed after ${elapsed}ms: ${String(err)}`);
|
||||
// Send error message to user so they know the command failed
|
||||
const errMsg = err instanceof Error ? err.message : String(err);
|
||||
const errorText = `⚠️ Command failed: ${errMsg}`;
|
||||
return {
|
||||
payload: undefined,
|
||||
payload: { text: errorText },
|
||||
meta: {
|
||||
durationMs: elapsed,
|
||||
queuedMs,
|
||||
|
||||
Reference in New Issue
Block a user