fix: CaseRun blocker visibility in status + cloud-api hwpod_node_not_connected error
This commit is contained in:
@@ -754,7 +754,7 @@ async function forwardHwpodNodeOpsPlan(targetUrl, plan, requestMeta, options) {
|
||||
});
|
||||
}
|
||||
if (target.ok && target.nodeId && target.nodeId !== plan.nodeId) {
|
||||
return directHwpodNodeBlocked(plan, "hwpod_node_id_mismatch", `configured hwpod-node URL is ${target.nodeId}, but plan targets ${plan.nodeId}`, {
|
||||
return directHwpodNodeBlocked(plan, "hwpod_node_not_connected", `${plan.nodeId} is not connected via WebSocket and HWLAB_HWPOD_NODE_OPS_URL points to ${target.nodeId}`, {
|
||||
requestedNodeId: plan.nodeId,
|
||||
targetNodeId: target.nodeId,
|
||||
targetUrl: redactNodeOpsUrl(targetUrl),
|
||||
|
||||
@@ -374,7 +374,9 @@ async function runCaseRunWorker(context: CaseContext) {
|
||||
return payload;
|
||||
} catch (error) {
|
||||
const run = await readRunFromDir(runDir).catch(() => loadControlRunSkeleton(workerContext, caseId, runId, runDir));
|
||||
await writeRunControl(workerContext, run, { status: "failed", stage: "failed", completedAt: context.now(), exitCode: 1, error: errorSummary(error) });
|
||||
const summary = errorSummary(error);
|
||||
const blocker = extractPrepareBlocker(summary);
|
||||
await writeRunControl(workerContext, run, { status: "failed", stage: "failed", completedAt: context.now(), exitCode: 1, error: summary, ...(blocker ? { blocker } : {}) });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -412,6 +414,7 @@ export async function statusCaseRun(context: CaseContext) {
|
||||
agent: run.agent ? agentSummary(run.agent) : null,
|
||||
traceLookup: run.agent ? agentTraceLookupForRun(run) : null,
|
||||
agentDiff: run.agentDiff ? diffSummary(run.agentDiff) : null,
|
||||
blocker: control.blocker ?? null,
|
||||
evidencePath: text(run.evidencePath ?? control.resultPath) || null,
|
||||
nextPollCommand: `hwlab-cli case run status ${run.runId} --state-dir ${stateRoot(context)}`,
|
||||
resultCommand: `hwlab-cli case run result ${run.runId} --state-dir ${stateRoot(context)}`,
|
||||
@@ -2437,6 +2440,18 @@ function errorSummary(error: unknown) {
|
||||
return { code: typeof (error as any)?.code === "string" ? (error as any).code : "caserun_worker_failed", message: error instanceof Error ? error.message : String(error), details: (error as any)?.details ?? null };
|
||||
}
|
||||
|
||||
function extractPrepareBlocker(summary: ReturnType<typeof errorSummary>) {
|
||||
const results = (summary.details as any)?.body?.body?.results ?? (summary.details as any)?.body?.results ?? [];
|
||||
if (!Array.isArray(results) || results.length === 0) return null;
|
||||
for (const r of results) {
|
||||
const blocker = (r as any)?.blocker;
|
||||
if (blocker && typeof blocker.code === "string") {
|
||||
return { code: blocker.code, summary: blocker.summary ?? "", layer: blocker.layer ?? null };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function commandVisibility(command: string[]) {
|
||||
return command.map((item) => item.includes("/") || item.includes("\\") ? path.basename(item) || item : item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user