mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-02-01 15:03:36 +00:00
fix: improve parallel orchestrator agent tracking clarity and cleanup
- Add comment on running_coding_agents explaining why feature_id keying is safe (start_feature checks for duplicates before spawning), since the sister dict running_testing_agents required PID keying to avoid overwrites from concurrent same-feature testing - Clear running_testing_agents dict in stop_all() after killing processes so get_status() doesn't report stale agent counts while _on_agent_complete callbacks are still in flight Follow-up to PR #130 (runaway testing agent spawn fix). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -169,6 +169,7 @@ class ParallelOrchestrator:
|
|||||||
# Thread-safe state
|
# Thread-safe state
|
||||||
self._lock = threading.Lock()
|
self._lock = threading.Lock()
|
||||||
# Coding agents: feature_id -> process
|
# Coding agents: feature_id -> process
|
||||||
|
# Safe to key by feature_id because start_feature() checks for duplicates before spawning
|
||||||
self.running_coding_agents: dict[int, subprocess.Popen] = {}
|
self.running_coding_agents: dict[int, subprocess.Popen] = {}
|
||||||
# Testing agents: pid -> (feature_id, process)
|
# Testing agents: pid -> (feature_id, process)
|
||||||
# Keyed by PID (not feature_id) because multiple agents can test the same feature
|
# Keyed by PID (not feature_id) because multiple agents can test the same feature
|
||||||
@@ -906,6 +907,11 @@ class ParallelOrchestrator:
|
|||||||
status=result.status, children_found=result.children_found,
|
status=result.status, children_found=result.children_found,
|
||||||
children_terminated=result.children_terminated, children_killed=result.children_killed)
|
children_terminated=result.children_terminated, children_killed=result.children_killed)
|
||||||
|
|
||||||
|
# Clear dict so get_status() doesn't report stale agents while
|
||||||
|
# _on_agent_complete callbacks are still in flight.
|
||||||
|
with self._lock:
|
||||||
|
self.running_testing_agents.clear()
|
||||||
|
|
||||||
async def run_loop(self):
|
async def run_loop(self):
|
||||||
"""Main orchestration loop."""
|
"""Main orchestration loop."""
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
|
|||||||
Reference in New Issue
Block a user