mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-31 14:43:35 +00:00
fix: prevent testing agents from running indefinitely
This fix addresses two root causes that caused testing agents to
accumulate (10-12 agents) instead of maintaining a 1:1 ratio with
coding agents:
1. Testing agents now exit after one session (agent.py)
- Added `or agent_type == "testing"` to the exit condition
- Previously, testing agents never hit the exit condition since
they're spawned with feature_id=None
2. Testing agents now spawn when coding agents START, not complete
- Moved spawn logic from _on_agent_complete() to start_feature()
- Removed the old spawn logic from _on_agent_complete()
- This ensures proper 1:1 ratio and prevents accumulation
Expected behavior after fix:
- First coding agent: no testing agent (no passing features yet)
- Subsequent coding agents: one testing agent spawns per start
- Each testing agent tests ONE feature then terminates immediately
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
9
agent.py
9
agent.py
@@ -306,9 +306,12 @@ async def run_autonomous_agent(
|
||||
print("The autonomous agent has finished its work.")
|
||||
break
|
||||
|
||||
# Single-feature mode: exit after one session (orchestrator manages agents)
|
||||
if feature_id is not None:
|
||||
print(f"\nSingle-feature mode: Feature #{feature_id} session complete.")
|
||||
# Single-feature mode OR testing agent: exit after one session
|
||||
if feature_id is not None or agent_type == "testing":
|
||||
if agent_type == "testing":
|
||||
print("\nTesting agent complete. Terminating session.")
|
||||
else:
|
||||
print(f"\nSingle-feature mode: Feature #{feature_id} session complete.")
|
||||
break
|
||||
|
||||
await asyncio.sleep(delay_seconds)
|
||||
|
||||
Reference in New Issue
Block a user