Enable lock-free parallel agent runs

This commit is contained in:
ZacharyZhang-NY committed 2026-04-22 20:23:44 -04:00
1 parent d13c9d83e8
commit 1a7eb8f1b3
18 files changed
+327 -194

No files matched your search

+6 -5
View File
@@ -15,11 +15,12 @@ interface ActiveRun {
}
/**
* Single source of truth for scheduling invariants: "one agent at a time"
* and "one exclusive-workspace lock at a time". Prior layout kept three
* parallel structures (`activeByAgent`, `activeByWorkspace`, queue) that
* had to be updated in lockstep. The Map-of-ActiveRun keyed by runId is
* the only authoritative record; agent/workspace busy checks iterate it.
* Single source of truth for scheduling invariants: one active run per
* agent and one active run per exclusive workspace lock. Prior layout
* kept three parallel structures (`activeByAgent`, `activeByWorkspace`,
* queue) that had to be updated in lockstep. The Map-of-ActiveRun keyed
* by runId is the only authoritative record; agent/workspace busy checks
* iterate it.
*/
const active = new Map<string, ActiveRun>();
const queue: RunJob[] = [];