diff options
| -rw-r--r-- | pi/agent/extensions/loop-scheduler/index.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pi/agent/extensions/loop-scheduler/index.ts b/pi/agent/extensions/loop-scheduler/index.ts index af6b003..d57d0c3 100644 --- a/pi/agent/extensions/loop-scheduler/index.ts +++ b/pi/agent/extensions/loop-scheduler/index.ts @@ -620,14 +620,16 @@ export default function loopSchedulerExtension(pi: ExtensionAPI): void { } function drainPendingWatchJobs(): void { - if (agentBusy) return; + if (agentBusy && !lastCtx?.isIdle()) return; + agentBusy = false; const nextPending = getOrderedWatchJobs().find((job) => job.pending); if (!nextPending) return; dispatchWatchJob(nextPending, nextPending.pendingReason ?? nextPending.condition.kind); } function drainPendingJobs(): void { - if (agentBusy) return; + if (agentBusy && !lastCtx?.isIdle()) return; + agentBusy = false; if (!allPaused) { const nextPendingLoop = getOrderedJobs().find((job) => job.pending); if (nextPendingLoop) { |
