openclaw/scripts/upgrade-survivor-diagnostics.mjs
RoboClaw 593401e948
fix(ci): expose bounded Docker survivor failure metadata (#159659)
* fix(ci): expose bounded Docker survivor failure metadata

Keep diagnostic artifacts and outcomes unchanged. Publish only redacted phase, exit and signal coordinates plus scheduler status and timeout flags as check annotations. Hosted review and CI remain pending; local dependency admission was unavailable.

Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com>

* fix(ci): retain survivor metadata beyond clipped failure tails

Use a bounded host metadata pipe within the existing scheduler process owner. Validate the three fields and emit only after process-group and log cleanup. Preserve artifact bytes and all lane outcomes. Fix the publisher consistent-return lint defect.

Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com>

* fix(ci): use typed Docker timeout flags directly

Remove two unnecessary boolean comparisons without changing annotation output or failure handling.

Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com>

---------

Co-authored-by: RomneyDa <6581799+RomneyDa@users.noreply.github.com>
2026-09-27 07:15:55 -07:00

34 lines
1.5 KiB
JavaScript

// Host-only entrypoint: this file and app source are never mounted into the
// package-under-test container. Keep the capture module dependency-light.
import { writeSync } from "node:fs";
import { publishDiagnostics } from "./e2e/lib/upgrade-survivor/diagnostics.mjs";
try {
const [mode, artifactRoot, destination, outcome = "failed"] = process.argv.slice(2);
if (mode !== "publish") {
throw new Error();
}
// The wrapper registers this harness's scripts/tsx.mjs before loading source.
const { redactSensitiveText } = await import("../src/logging/redact.ts");
const failure = publishDiagnostics(artifactRoot, destination, redactSensitiveText, outcome);
// Use the host scheduler pipe, which is not forwarded into the container.
// Wrapper cleanup and bounded log tails cannot clip this published receipt.
if (failure && process.env.OPENCLAW_DOCKER_FAILURE_METADATA_FD === "3") {
try {
writeSync(3, `${JSON.stringify(failure)}\n`);
} catch {
process.stderr.write("Upgrade survivor failure metadata unavailable.\n");
}
} else if (process.env.GITHUB_ACTIONS === "true" && failure) {
const phase = failure.phase
.replaceAll("%", "%25")
.replaceAll("\r", "%0D")
.replaceAll("\n", "%0A");
process.stderr.write(
`::error title=Upgrade survivor failure::phase=${phase}; exitStatus=${failure.exitStatus}; signal=${failure.signal ?? "none"}\n`,
);
}
} catch {
process.stderr.write("Upgrade survivor diagnostics missing: safe host publication failed.\n");
process.exitCode = 1;
}