feat(engine): gate executor and heartbeat on allowParallelExecution
When a permanent agent has allowParallelExecution=false, TaskExecutor.execute() defers if the agent has an active heartbeat run, and HeartbeatScheduler defers a heartbeat if the agent's bound task has an active executor session. Each side re-dispatches the other's deferred work on completion via resumeTaskForAgent and the in-process runtime's onRunCompleted hook. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -448,6 +448,13 @@ export class InProcessRuntime
|
||||
onTerminated: (agentId, reason) => {
|
||||
runtimeLog.warn(`Agent ${agentId} terminated (unresponsive): ${reason}`);
|
||||
},
|
||||
onRunCompleted: (agentId) => {
|
||||
if (this.executor) {
|
||||
void this.executor.resumeTaskForAgent(agentId).catch((err) => {
|
||||
runtimeLog.warn(`resumeTaskForAgent failed for ${agentId}: ${err instanceof Error ? err.message : String(err)}`);
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
this.heartbeatMonitor.start();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user