fix(FN-5137): complete Step 2-3 — guard deleted tasks in snapshot and executor
Fusion-Task-Id: FN-5137 Fusion-Task-Lineage: bb2e2e56-d64c-46ca-a6c8-abda13029fc2
This commit is contained in:
committed by
gsxdsm
parent
4eccbe2fb5
commit
9b6513af71
@@ -86,6 +86,7 @@ export class AutoClaimSnapshotManager {
|
||||
&& candidate.paused !== true
|
||||
&& !candidate.assignedAgentId
|
||||
&& !candidate.checkedOutBy
|
||||
&& !candidate.deletedAt
|
||||
&& candidate.dependencies.every((dependencyId) => {
|
||||
const dependency = tasksById.get(dependencyId);
|
||||
return dependency?.column === "done" || dependency?.column === "archived";
|
||||
|
||||
@@ -2573,6 +2573,7 @@ export class TaskExecutor {
|
||||
for (const task of tasks) {
|
||||
if (
|
||||
task.assignedAgentId === agentId
|
||||
&& !task.deletedAt
|
||||
&& !task.paused
|
||||
&& !this.executing.has(task.id)
|
||||
&& !this.activeSessions.has(task.id)
|
||||
@@ -2607,7 +2608,7 @@ export class TaskExecutor {
|
||||
|
||||
const tasks = await this.store.listTasks({ slim: true, column: "in-progress" });
|
||||
const inProgress = tasks.filter(
|
||||
(t) => t.column === "in-progress" && !this.executing.has(t.id) && !t.paused,
|
||||
(t) => t.column === "in-progress" && !t.deletedAt && !this.executing.has(t.id) && !t.paused,
|
||||
);
|
||||
|
||||
if (inProgress.length === 0) return;
|
||||
@@ -2725,6 +2726,13 @@ export class TaskExecutor {
|
||||
// consistent with the process-wide lock.
|
||||
this.executing.add(task.id);
|
||||
|
||||
if (task.deletedAt) {
|
||||
executorLog.warn(`${task.id}: refusing execute — task is soft-deleted`);
|
||||
this.executing.delete(task.id);
|
||||
executingTaskLock.release(task.id);
|
||||
return;
|
||||
}
|
||||
|
||||
const assignedAgentId = task.assignedAgentId;
|
||||
if (assignedAgentId && await this.shouldDeferForHeartbeat(assignedAgentId)) {
|
||||
executorLog.log(`${task.id}: skipping execute — agent ${assignedAgentId} has active heartbeat run (allowParallelExecution=false)`);
|
||||
|
||||
Reference in New Issue
Block a user