mirror of
https://github.com/larchanka/manbot.git
synced 2026-05-13 13:39:40 +00:00
fix(orchestrator): Ensure abandoned tasks are marked as failed on error
This commit is contained in:
@@ -565,6 +565,9 @@ export class Orchestrator {
|
||||
if (details.originalErrorMessage != null) parts.push(String(details.originalErrorMessage));
|
||||
lastError = parts.join(" ");
|
||||
}
|
||||
|
||||
this.sendAndWait(taskMemory, "task.fail", { taskId, reason: lastError }).catch(() => { });
|
||||
|
||||
if (attempt === Orchestrator.MAX_PLAN_RETRIES) {
|
||||
this.sendToTelegram(chatId, lastError);
|
||||
return;
|
||||
@@ -576,6 +579,9 @@ export class Orchestrator {
|
||||
const plan = planPayload.result as { nodes: unknown[]; edges?: unknown[]; complexity?: string } | undefined;
|
||||
if (!plan?.nodes || !Array.isArray(plan.nodes)) {
|
||||
lastError = "Invalid plan from planner: missing or invalid nodes.";
|
||||
|
||||
this.sendAndWait(taskMemory, "task.fail", { taskId, reason: lastError }).catch(() => { });
|
||||
|
||||
if (attempt === Orchestrator.MAX_PLAN_RETRIES) {
|
||||
this.sendToTelegram(chatId, lastError);
|
||||
return;
|
||||
@@ -616,6 +622,9 @@ export class Orchestrator {
|
||||
if (details.originalErrorMessage != null) parts.push(String(details.originalErrorMessage));
|
||||
lastError = parts.join(". ");
|
||||
}
|
||||
|
||||
this.sendAndWait(taskMemory, "task.fail", { taskId, reason: lastError }).catch(() => { });
|
||||
|
||||
if (attempt === Orchestrator.MAX_PLAN_RETRIES) {
|
||||
this.sendToTelegram(chatId, lastError);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user