MCPcopy Index your code
hub / github.com/openai/codex-plugin-cc / scheduleInferredCompletion

Function scheduleInferredCompletion

plugins/codex/scripts/lib/codex.mjs:373–394  ·  view source on GitHub ↗
(state)

Source from the content-addressed store, hash-verified

371}
372
373function scheduleInferredCompletion(state) {
374 if (state.completed || state.finalTurn || !state.finalAnswerSeen) {
375 return;
376 }
377
378 if (state.pendingCollaborations.size > 0 || state.activeSubagentTurns.size > 0) {
379 return;
380 }
381
382 clearCompletionTimer(state);
383 state.completionTimer = setTimeout(() => {
384 state.completionTimer = null;
385 if (state.completed || state.finalTurn || !state.finalAnswerSeen) {
386 return;
387 }
388 if (state.pendingCollaborations.size > 0 || state.activeSubagentTurns.size > 0) {
389 return;
390 }
391 completeTurn(state, null, { inferred: true });
392 }, 250);
393 state.completionTimer.unref?.();
394}
395
396function belongsToTurn(state, message) {
397 const messageThreadId = extractThreadId(message);

Callers 2

recordItemFunction · 0.85
applyTurnNotificationFunction · 0.85

Calls 2

clearCompletionTimerFunction · 0.85
completeTurnFunction · 0.85

Tested by

no test coverage detected