mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:00:44 +00:00
fix(release): accept logged cross-os agent output
(cherry picked from commit a58ee7c8bc)
This commit is contained in:
@@ -1759,8 +1759,7 @@ async function runInstalledAgentTurn(params) {
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
});
|
||||
const payloadTexts = parseAgentPayloadTexts(result.stdout);
|
||||
if (!payloadTexts.some((text) => text.trim() === "OK")) {
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logPath: params.logPath })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
}
|
||||
return result;
|
||||
@@ -2405,13 +2404,28 @@ async function runAgentTurn(params) {
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
});
|
||||
const payloadTexts = parseAgentPayloadTexts(result.stdout);
|
||||
if (!payloadTexts.some((text) => text.trim() === "OK")) {
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logPath: params.logPath })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function agentOutputHasExpectedOkMarker(stdout, options = {}) {
|
||||
const payloadTexts = parseAgentPayloadTexts(stdout);
|
||||
if (payloadTexts.some((text) => text.trim() === "OK")) {
|
||||
return true;
|
||||
}
|
||||
if (typeof options.logPath !== "string") {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const logTexts = parseAgentPayloadTexts(readFileSync(options.logPath, "utf8"));
|
||||
return logTexts.some((text) => text.trim() === "OK");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function parseAgentPayloadTexts(stdout) {
|
||||
try {
|
||||
const payload = JSON.parse(stdout);
|
||||
|
||||
Reference in New Issue
Block a user