mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-28 06:31:11 +00:00
ci: retry cross-os agent runtime deps staging
This commit is contained in:
parent
4397717322
commit
2f2aee5fe8
2 changed files with 62 additions and 20 deletions
|
|
@ -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 = {}) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import {
|
|||
shouldSkipInstallerDaemonHealthCheck,
|
||||
shouldStopManagedGatewayBeforeManualFallback,
|
||||
shouldRunMainChannelDevUpdate,
|
||||
shouldRetryCrossOsAgentTurnError,
|
||||
shouldUseManagedGatewayForInstallerRuntime,
|
||||
shouldUseManagedGatewayService,
|
||||
verifyDevUpdateStatus,
|
||||
|
|
@ -83,6 +84,22 @@ describe("scripts/openclaw-cross-os-release-checks", () => {
|
|||
}
|
||||
});
|
||||
|
||||
it("retries transient bundled runtime deps staging failures during agent turns", () => {
|
||||
expect(
|
||||
shouldRetryCrossOsAgentTurnError(
|
||||
new Error("document-extract: failed to install bundled runtime deps: npm install failed"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
shouldRetryCrossOsAgentTurnError(
|
||||
new Error("document-extract failed to stage bundled runtime deps after 463ms"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(shouldRetryCrossOsAgentTurnError(new Error("Agent output did not contain OK."))).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("treats explicit empty-string args as values instead of boolean flags", () => {
|
||||
expect(parseArgs(["--ubuntu-runner", "", "--mode", "both"])).toEqual({
|
||||
"ubuntu-runner": "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue