feat(FN-2274): add engine-level stale-task safeguards in heartbeat execution

- HeartbeatMonitor.executeHeartbeat() now checks if resolved task is done/archived
  and exits before session creation with reason 'task_closed'
- When stale task came from persisted agent.taskId, clears the linkage to prevent
  repeated stale activations
- HeartbeatTriggerScheduler.watchAssignments() now skips assignment callback dispatch
  when assigned task is done/archived (when taskStore is available)
- Added comprehensive tests for stale-task activation guard behavior
This commit is contained in:
gsxdsm
2026-04-22 21:14:44 -07:00
parent 18503b2da5
commit 9dabb87c30
4 changed files with 63 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ export {
computeAccessState,
isValidPermission,
} from "./agent-permissions.js";
export { AgentStore } from "./agent-store.js";
export { AgentStore, DEFAULT_AGENT_HEARTBEAT_INTERVAL_MS } from "./agent-store.js";
export type { AgentStoreEvents } from "./agent-store.js";
export { ReflectionStore } from "./reflection-store.js";
export type { ReflectionStoreEvents } from "./reflection-store.js";