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

Function waitUntilIdle

orchestrate/skills/orchestrate/scripts/tools/nudge-root.ts:178–198  ·  view source on GitHub ↗
(args: Args, deadline: number)

Source from the content-addressed store, hash-verified

176}
177
178async function waitUntilIdle(args: Args, deadline: number): Promise<void> {
179 let attempt = 0;
180 while (Date.now() < deadline) {
181 attempt++;
182 try {
183 const runs = await Agent.listRuns(args.agentId, {
184 runtime: "cloud",
185 limit: 1,
186 });
187 const status = runs.items[0]?.status;
188 log(`idle-check ${attempt}: status=${status ?? "(no runs)"}`);
189 if (status !== "running") return;
190 } catch (err) {
191 const msg = err instanceof Error ? err.message : String(err);
192 log(`idle-check ${attempt}: Agent.listRuns failed: ${msg}`);
193 }
194 await sleep(args.pollMs);
195 }
196 log(`idle-wait exhausted after ${args.maxWaitMs / 1000}s; giving up`);
197 process.exit(4);
198}
199
200async function sendWithBusyRetry(args: Args, deadline: number): Promise<void> {
201 let attempt = 0;

Callers 1

nudge-root.tsFile · 0.85

Calls 2

logFunction · 0.85
sleepFunction · 0.85

Tested by

no test coverage detected