Design: Implement parallel agent capacity limits and queueing #37
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Testing revealed that running 8+ parallel opencode agents causes timeouts due to resource contention. Current implementation has no built-in limits.
Questions to Resolve
What happens when max agents is reached?
Where does the queue live?
Queue ordering?
Queue timeout?
Backpressure signaling?
Current Behavior
Implementation Options
Option A: Simple Semaphore
Option B: Queue with Persistence
Option C: PM Agent Self-Regulation
Out of Scope for This Issue
Related
tools/parallel-capacity-test/Feedback
Great design issue! Here is my analysis based on the kugetsu architecture:
Recommended Approach: Option C (PM Agent Self-Regulation) + Minimal Queue
Why not pure Option A (Semaphore):
Why not full Option B (Persistent Queue):
Proposed Hybrid Design
1. PM Agent tracks active count in memory
active_agents: [session_ids]2. User-facing queue via kugetsu index
~/.kugetsu/index.jsonkugetsu queue3. Queue behavior:
4. Queue ordering:
Where to Implement
Capacity Limit
Based on testing, 5 agents seems reasonable. But this should be:
~/.kugetsu/config.jsonIntegration with Phase 3
For Telegram UX, the PM agent needs to:
kugetsu queuebefore delegatingQuestions