MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / selectRunnable

Method selectRunnable

src/orchestration/scheduler.ts:99–114  ·  view source on GitHub ↗

Pick ready nodes that don't collide (by file) with locked or each other.

(slots: number)

Source from the content-addressed store, hash-verified

97
98 /** Pick ready nodes that don't collide (by file) with locked or each other. */
99 private selectRunnable(slots: number): TaskNode[] {
100 const locked = this.lockedFiles();
101 const chosen: TaskNode[] = [];
102 const willLock = new Set<string>();
103
104 for (const node of this.graph.nodes.values()) {
105 if (chosen.length >= slots) break;
106 if (node.status !== 'ready') continue;
107 // Skip if any target file is locked by an in-flight node or an earlier pick.
108 const collides = node.targetFiles.some(f => locked.has(f) || willLock.has(f));
109 if (collides) continue;
110 chosen.push(node);
111 for (const f of node.targetFiles) willLock.add(f);
112 }
113 return chosen;
114 }
115
116 /** Promote pending nodes whose deps are committed → ready; block broken ones. */
117 private refreshStatuses() {

Callers 1

runMethod · 0.95

Calls 4

lockedFilesMethod · 0.95
addMethod · 0.80
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected