-
Notifications
You must be signed in to change notification settings - Fork 0
Implement loop prevention (depth limits, dedup, circuit breakers, ancestry) #17
Copy link
Copy link
Closed
Labels
prio:criticalBlocks other work, must do firstBlocks other work, must do firstscope:medium1-3 days of work1-3 days of workspec:agent-systemDESIGN_SPEC Section 3 - Agent SystemDESIGN_SPEC Section 3 - Agent Systemspec:communicationDESIGN_SPEC Section 5 - Communication ArchitectureDESIGN_SPEC Section 5 - Communication Architecturespec:task-workflowDESIGN_SPEC Section 6 - Task & Workflow EngineDESIGN_SPEC Section 6 - Task & Workflow Enginetype:featureNew feature implementationNew feature implementation
Description
Context
Implement all 5 loop prevention mechanisms from spec section 5.5. Delegation loops are a critical failure mode in multi-agent systems where agents can endlessly delegate tasks back and forth, consuming resources and never completing work.
Acceptance Criteria
Five Prevention Mechanisms
- Max delegation depth — default limit of 5 levels; configurable
- Rate limiting — max 10 delegations per agent pair per minute; configurable
- Identical request dedup — reject duplicate requests within a 60-second window
- Circuit breaker — after 3 bounces between same agents, trigger 5-minute cooldown
- Task ancestry tracking — prevent delegation to any agent in the current task's ancestor chain
On Loop Detection
- Block the delegation attempt
- Notify the sending agent with a clear error message
- Escalate to manager or human-in-the-loop
- Log the loop detection event with full context
Configuration & Testing
- All thresholds configurable via `LoopPreventionConfig` model
- Clear, actionable error messages on detection
- Escalation pathway works end-to-end
- Unit tests for each of the 5 mechanisms individually
- Integration test that creates a would-be loop and verifies prevention
Dependencies
- Depends on agent-to-agent messaging (Implement agent-to-agent messaging with channels and topics #10)
Design Spec Reference
- Section 5.5 — Loop Prevention
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:criticalBlocks other work, must do firstBlocks other work, must do firstscope:medium1-3 days of work1-3 days of workspec:agent-systemDESIGN_SPEC Section 3 - Agent SystemDESIGN_SPEC Section 3 - Agent Systemspec:communicationDESIGN_SPEC Section 5 - Communication ArchitectureDESIGN_SPEC Section 5 - Communication Architecturespec:task-workflowDESIGN_SPEC Section 6 - Task & Workflow EngineDESIGN_SPEC Section 6 - Task & Workflow Enginetype:featureNew feature implementationNew feature implementation