fix: allow hwlab v03 control-plane rerun

This commit is contained in:
Codex
2026-06-14 06:59:52 +00:00
parent d5241af9ae
commit 2f602801e4
+38 -13
View File
@@ -129,6 +129,7 @@ interface G14ControlPlaneOptions {
dryRun: boolean;
confirm: boolean;
wait: boolean;
rerun: boolean;
allowLiveDbRead: boolean;
timeoutSeconds: number;
minAgeMinutes: number;
@@ -409,6 +410,7 @@ function parseControlPlaneOptions(args: string[]): G14ControlPlaneOptions {
lane,
confirm,
wait: args.includes("--wait"),
rerun: args.includes("--rerun") || rawAction === "rerun-current",
allowLiveDbRead,
dryRun: actionRaw === "status" || actionRaw === "closeout" ? true : explicitDryRun || !confirm,
timeoutSeconds: positiveIntegerOption(args, "--timeout-seconds", 120, 600),
@@ -4315,6 +4317,11 @@ function runRuntimeLaneControlPlane(spec: HwlabRuntimeLaneSpec, options: G14Cont
}
let pipelineRun = runtimeLanePipelineRunName(spec, sourceCommit);
let before = getPipelineRunCompact(pipelineRun);
const originalPipelineRun = pipelineRun;
if (options.rerun && before.exists === true) {
pipelineRun = runtimeLaneRerunPipelineRunName(spec, sourceCommit);
before = getPipelineRunCompact(pipelineRun);
}
if (options.dryRun) {
return {
ok: true,
@@ -4323,6 +4330,8 @@ function runRuntimeLaneControlPlane(spec: HwlabRuntimeLaneSpec, options: G14Cont
mode: "dry-run",
sourceCommit,
pipelineRun,
rerun: options.rerun,
originalPipelineRun: options.rerun ? originalPipelineRun : undefined,
before,
gitMirrorSync: {
mode: "skipped-dry-run",
@@ -4383,19 +4392,35 @@ function runRuntimeLaneControlPlane(spec: HwlabRuntimeLaneSpec, options: G14Cont
};
}
if (before.exists === true && effectiveBeforeStatus !== null) {
return {
ok: false,
command: `hwlab g14 control-plane trigger-current --lane ${spec.lane}`,
lane: spec.lane,
mode: "confirmed-trigger",
sourceCommit,
pipelineRun,
before,
skipped: true,
reason: "existing-pipelinerun-terminal-failed",
degradedReason: "existing-pipelinerun-terminal-failed",
next: { status: `bun scripts/cli.ts hwlab g14 control-plane status --lane ${spec.lane} --pipeline-run ${pipelineRun}` },
};
if (options.rerun === true) {
pipelineRun = runtimeLaneRerunPipelineRunName(spec, sourceCommit);
before = getPipelineRunCompact(pipelineRun);
printRuntimeLaneTriggerProgress(spec, {
stage: "existing-pipelinerun",
status: "explicit-rerun-required",
sourceCommit,
pipelineRun,
previousPipelineRun: originalPipelineRun,
previousStatus: effectiveBeforeStatus,
});
} else {
return {
ok: false,
command: `hwlab g14 control-plane trigger-current --lane ${spec.lane}`,
lane: spec.lane,
mode: "confirmed-trigger",
sourceCommit,
pipelineRun,
before,
skipped: true,
reason: "existing-pipelinerun-terminal-failed",
degradedReason: "existing-pipelinerun-terminal-failed",
next: {
rerun: `bun scripts/cli.ts hwlab g14 control-plane trigger-current --lane ${spec.lane} --confirm --rerun`,
status: `bun scripts/cli.ts hwlab g14 control-plane status --lane ${spec.lane} --pipeline-run ${pipelineRun}`,
},
};
}
}
printRuntimeLaneTriggerProgress(spec, {
stage: "git-mirror-sync",