feat(FN-4005): harden durable transient recovery auto-restart flow

- Add bounded auto-restart handling in in-process runtime for durable agents after transient failures
- Extend self-healing recovery logic and transient error detection to classify and recover retryable runtime interruptions
- Add regression coverage across heartbeat executor, self-healing, and transient detector test suites
- Document durable agent transient recovery behavior in docs/agents.md

Fusion-Task-Id: FN-4005
This commit is contained in:
Fusion
2026-05-11 09:17:08 -07:00
committed by gsxdsm
parent ef4aeb253a
commit dfdfa722ed
7 changed files with 330 additions and 7 deletions

View File

@@ -635,6 +635,25 @@ export class InProcessRuntime
enqueueMerge: this.mergeEnqueuer ? (taskId: string) => this.mergeEnqueuer?.(taskId) : undefined,
getActiveMergeTaskId: () => this.activeMergeTaskIdProvider?.() ?? null,
leaseManager: this.leaseManager,
hasActiveAgentExecution: (agentId: string) => this.heartbeatMonitor?.getTrackedAgents().includes(agentId) ?? false,
restartDurableAgentHeartbeat: async (agentId: string, context: { reason: string; attempt: number }) => {
if (!this.heartbeatMonitor) {
return false;
}
const run = await this.heartbeatMonitor.executeHeartbeat({
agentId,
source: "automation",
triggerDetail: `self-healing durable-agent transient recovery (${context.reason}, attempt ${context.attempt})`,
contextSnapshot: {
selfHealing: {
reason: context.reason,
attempt: context.attempt,
source: "durable-agent-transient-error-recovery",
},
},
});
return !!run;
},
});
this.selfHealingManager.start();
this.stuckTaskDetector.start();