( mgr: AgentManager, running: Promise<void>[] )
| 121 | } |
| 122 | |
| 123 | async function spawnReadyPending( |
| 124 | mgr: AgentManager, |
| 125 | running: Promise<void>[] |
| 126 | ): Promise<void> { |
| 127 | await drainCommentRetryQueue({ |
| 128 | workspace: mgr.workspace, |
| 129 | destinations: mgr.commentDestinations(), |
| 130 | logAttention: line => mgr.logAttention(line), |
| 131 | allowedSlackThread: mgr.plan.slackKickoffRef |
| 132 | ? { |
| 133 | channel: mgr.plan.slackKickoffRef.channel, |
| 134 | threadTs: mgr.plan.slackKickoffRef.ts, |
| 135 | } |
| 136 | : undefined, |
| 137 | }); |
| 138 | await mgr.andon.drainEvents(); |
| 139 | if (mgr.andon.isActive()) { |
| 140 | mgr.andon.noteSpawnPaused(); |
| 141 | return; |
| 142 | } |
| 143 | for (const def of planTasks(mgr.plan)) { |
| 144 | const s = mgr.getTask(def.name); |
| 145 | if (!s || s.status !== "pending") continue; |
| 146 | if (!mgr.depsSatisfied(s)) continue; |
| 147 | const spawned = await mgr.spawnTask(def); |
| 148 | if (spawned) running.push(mgr.waitAndHandoff(spawned)); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Progress is possible iff some task is running OR at least one pending task |
no test coverage detected