fix(agent): align investigation waits and interruption messages
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:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user