chore: read agentrun hwlab defaults from yaml
This commit is contained in:
+23
-1
@@ -3,6 +3,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSy
|
||||
import { join } from "node:path";
|
||||
import { repoRoot, rootPath } from "./config";
|
||||
import { runCommandToFiles, tailFile } from "./command";
|
||||
import { hwlabDefaultRuntimeTarget } from "./hwlab-node-lanes";
|
||||
|
||||
export type JobStatus = "queued" | "running" | "succeeded" | "failed" | "canceled";
|
||||
|
||||
@@ -438,6 +439,8 @@ function summarizeRuntimeLaneTriggerJobProgress(job: JobRecord, stdoutTail: stri
|
||||
stageElapsedSeconds,
|
||||
lastEventAgeSeconds,
|
||||
});
|
||||
const nextStatusCommand = hwlabRuntimeLaneStatusNextCommand(pipelineRun, lastEvent);
|
||||
if (nextStatusCommand.warning !== null) warnings.push(nextStatusCommand.warning);
|
||||
const tcpPoolDiagnostics = job.status === "succeeded" ? null : sshTcpPoolDiagnosticsFromJobText(`${stderrTail}\n${stdoutTail}`);
|
||||
const slow = warnings.length > 0;
|
||||
return {
|
||||
@@ -469,13 +472,32 @@ function summarizeRuntimeLaneTriggerJobProgress(job: JobRecord, stdoutTail: stri
|
||||
slow ? "visibility-warning" : null,
|
||||
].filter(Boolean).join(" "),
|
||||
nextCommand: pipelineRun
|
||||
? `bun scripts/cli.ts hwlab nodes control-plane status --node ${stringField(lastEvent.node) ?? "G14"} --lane ${stringField(lastEvent.lane) ?? "v03"} --pipeline-run ${pipelineRun}`
|
||||
? nextStatusCommand.command
|
||||
: job.status === "running"
|
||||
? `bun scripts/cli.ts job status ${job.id} --tail-bytes 12000`
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
function hwlabRuntimeLaneStatusNextCommand(pipelineRun: string | null, lastEvent: Record<string, unknown>): { command: string | null; warning: string | null } {
|
||||
if (pipelineRun === null) return { command: null, warning: null };
|
||||
const eventNode = stringField(lastEvent.node);
|
||||
const eventLane = stringField(lastEvent.lane);
|
||||
const defaults = hwlabDefaultRuntimeTarget();
|
||||
const node = eventNode ?? defaults.node;
|
||||
const lane = eventLane ?? defaults.lane;
|
||||
const missing = [
|
||||
eventNode === null ? "node" : null,
|
||||
eventLane === null ? "lane" : null,
|
||||
].filter((value): value is string => value !== null);
|
||||
return {
|
||||
command: `bun scripts/cli.ts hwlab nodes control-plane status --node ${node} --lane ${lane} --pipeline-run ${pipelineRun}`,
|
||||
warning: missing.length === 0
|
||||
? null
|
||||
: `runtime lane progress event missing ${missing.join("/")} for nextCommand; used YAML default ${defaults.node}/${defaults.lane} from config/hwlab-node-lanes.yaml`,
|
||||
};
|
||||
}
|
||||
|
||||
function sshTcpPoolDiagnosticsFromJobText(text: string): Record<string, unknown> | null {
|
||||
const hint = lastJsonLinePayload(text, "UNIDESK_SSH_TCP_POOL_HINT");
|
||||
if (hint !== null) return hint;
|
||||
|
||||
Reference in New Issue
Block a user