fix: propagate queue cancel to run state
This commit is contained in:
+2
-2
@@ -495,8 +495,8 @@ export class MemoryAgentRunStore implements AgentRunStore {
|
||||
cancelQueueTask(taskId: string, reason = "cancel requested"): QueueTaskRecord {
|
||||
const task = this.getQueueTask(taskId);
|
||||
if (isTerminalQueueTaskState(task.state)) return task;
|
||||
if (task.latestAttempt?.commandId) this.cancelCommand(task.latestAttempt.commandId, reason);
|
||||
else if (task.latestAttempt?.runId) this.cancelRun(task.latestAttempt.runId, reason);
|
||||
if (task.latestAttempt?.runId) this.cancelRun(task.latestAttempt.runId, reason);
|
||||
else if (task.latestAttempt?.commandId) this.cancelCommand(task.latestAttempt.commandId, reason);
|
||||
const at = nowIso();
|
||||
const latestAttempt = task.latestAttempt ? { ...task.latestAttempt, state: "cancelled" as const } : null;
|
||||
const next: QueueTaskRecord = { ...task, state: "cancelled", latestAttempt, version: this.nextQueueVersion(), updatedAt: at, cancelledAt: at, cancelReason: reason };
|
||||
|
||||
Reference in New Issue
Block a user