MCPcopy Create free account
hub / github.com/cursor/plugins / spawnReadyPending

Function spawnReadyPending

orchestrate/skills/orchestrate/scripts/core/loop.ts:123–150  ·  view source on GitHub ↗
(
  mgr: AgentManager,
  running: Promise<void>[]
)

Source from the content-addressed store, hash-verified

121}
122
123async 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

Callers 1

runOrchestrateLoopFunction · 0.85

Calls 11

drainCommentRetryQueueFunction · 0.90
commentDestinationsMethod · 0.80
logAttentionMethod · 0.80
drainEventsMethod · 0.80
isActiveMethod · 0.80
noteSpawnPausedMethod · 0.80
getTaskMethod · 0.80
depsSatisfiedMethod · 0.80
spawnTaskMethod · 0.80
waitAndHandoffMethod · 0.80
planTasksFunction · 0.70

Tested by

no test coverage detected