fix(agent): align investigation waits and interruption messages
Generic Container CI/CD / test-build-publish (push) Successful in 54s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 54s

Separate waiting-stage reports from final recovery closure and route resumed runs through the actual handling phase. Keep superseded runs distinct from expired leases and transport failures, with focused heartbeat response coverage.
This commit is contained in:
2026-11-12 13:45:27 +08:00
parent f7e411c288
commit 9a77cb0557
7 changed files with 52 additions and 9 deletions
+7
View File
@@ -404,6 +404,13 @@ export class OperationalTaskClientError extends Error {
}
}
export function taskRunInterruptionMessage(error: Error): string {
const code = error instanceof OperationalTaskClientError ? error.code : undefined;
if (code === "RUN_SUPERSEDED") return "任务已收到更新,本轮执行已停止,由新一轮执行接续。";
if (code === "LEASE_EXPIRED") return "工况任务租约已失效,本次执行已停止,等待任务重新领取。";
return "工况任务心跳校验失败,本次执行已停止,请检查任务状态或服务连接。";
}
/** Feed a concrete Server coverage rejection back into the same active investigation. */
export function scadaPresentationContinuation(error: unknown): string | null {
if (!(error instanceof OperationalTaskClientError) || error.code !== "SCADA_PRESENTATION_INCOMPLETE") return null;
+2 -1
View File
@@ -46,6 +46,7 @@ import {
operationalTaskClient,
releaseOperationalTaskCredential,
createScadaPresentationContinuation,
taskRunInterruptionMessage,
} from "../product/operational-task-client.js";
import { type SessionTranscriptStore } from "../sessions/transcriptStore.js";
import { type SessionUiStateStore } from "../sessions/uiStateStore.js";
@@ -840,7 +841,7 @@ export const registerChatStreamRoute = (
} else if (taskLeaseFailure) {
publish("error", {
session_id: clientSessionId,
message: "工况任务租约已失效,本次执行已停止,等待任务重新领取。",
message: taskRunInterruptionMessage(taskLeaseFailure),
detail: taskLeaseFailure.message,
});
} else if (streamResult.failed && sessionPurpose === "task_execution" && activeSessionRecord.taskId) {