fix: accept migration command arguments

This commit is contained in:
AgentRun Codex
2026-07-13 02:54:31 +00:00
parent 8d091e3de8
commit 0757464fb6
2 changed files with 14 additions and 3 deletions
+5 -1
View File
@@ -263,10 +263,14 @@ export function migrationJobPayloadFromProbe(probe: Record<string, unknown>): Re
const expectedCommand = container === "export" ? "web-probe sentinel migration export" : container === "import" ? "web-probe sentinel migration import" : container === "verify" ? "web-probe sentinel migration verify" : null;
const containerLogs = isRecord(probe.containerLogs) ? probe.containerLogs : {};
const payload = container === null ? {} : sentinelPayloadFromLogs(String(containerLogs[container] ?? ""));
if (expectedCommand !== null && payload.command === expectedCommand && (payload.ok === true || payload.ok === false)) return payload;
if (expectedCommand !== null && migrationPayloadCommandMatches(payload.command, expectedCommand) && (payload.ok === true || payload.ok === false)) return payload;
return { ok: false, error: { code: "monitor-migration-job-result-missing", message: expectedCommand === null ? "migration Job failed without an identifiable terminated container result" : `migration Job ${container} container did not emit the expected structured result` }, valuesRedacted: true };
}
function migrationPayloadCommandMatches(value: unknown, expected: string): boolean {
return typeof value === "string" && (value === expected || value.startsWith(`${expected} `));
}
function migrationFailedContainerName(probe: Record<string, unknown>): string | null {
const containers = Array.isArray(probe.containers) ? probe.containers.filter(isRecord) : [];
return stringAtNullable(containers.find((container) => finiteNumberOrNull(container.exitCode) !== null && finiteNumberOrNull(container.exitCode) !== 0), "name");