mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:20:42 +00:00
ci: retry cross-os agent runtime deps staging
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import { spawn } from "node:child_process";
|
||||
import {
|
||||
appendFileSync,
|
||||
chmodSync,
|
||||
createWriteStream,
|
||||
existsSync,
|
||||
@@ -2552,27 +2553,51 @@ async function runModelsSet(params) {
|
||||
}
|
||||
|
||||
async function runAgentTurn(params) {
|
||||
const sessionId = `cross-os-release-check-${params.label}-${Date.now()}`;
|
||||
const result = await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"agent",
|
||||
"--agent",
|
||||
"main",
|
||||
"--session-id",
|
||||
sessionId,
|
||||
"--message",
|
||||
"Reply with exact ASCII text OK only.",
|
||||
"--json",
|
||||
],
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
});
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logPath: params.logPath })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
let lastError;
|
||||
for (let attempt = 1; attempt <= 2; attempt += 1) {
|
||||
const sessionId = `cross-os-release-check-${params.label}-${Date.now()}-${attempt}`;
|
||||
try {
|
||||
const result = await runOpenClaw({
|
||||
lane: params.lane,
|
||||
env: params.env,
|
||||
args: [
|
||||
"agent",
|
||||
"--agent",
|
||||
"main",
|
||||
"--session-id",
|
||||
sessionId,
|
||||
"--message",
|
||||
"Reply with exact ASCII text OK only.",
|
||||
"--json",
|
||||
],
|
||||
logPath: params.logPath,
|
||||
timeoutMs: 10 * 60 * 1000,
|
||||
});
|
||||
if (!agentOutputHasExpectedOkMarker(result.stdout, { logPath: params.logPath })) {
|
||||
throw new Error("Agent output did not contain the expected OK marker.");
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (attempt >= 2 || !shouldRetryCrossOsAgentTurnError(error)) {
|
||||
throw error;
|
||||
}
|
||||
appendFileSync(
|
||||
params.logPath,
|
||||
`\n[release-checks] retrying agent turn after bundled runtime deps staging failure: ${
|
||||
error instanceof Error ? error.message : String(error)
|
||||
}\n`,
|
||||
);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
throw lastError;
|
||||
}
|
||||
|
||||
export function shouldRetryCrossOsAgentTurnError(error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
return /failed to (?:install|stage) bundled runtime deps|failed to stage bundled runtime deps after/u.test(
|
||||
message,
|
||||
);
|
||||
}
|
||||
|
||||
export function agentOutputHasExpectedOkMarker(stdout, options = {}) {
|
||||
|
||||
Reference in New Issue
Block a user