This repository was archived by the owner on Apr 4, 2026. It is now read-only.
feat(#25): Subordinate delegation loop prevention and depth limits#40
Merged
Conversation
- Add max_agent_depth to AgentConfig (default 5) - Refuse delegation when depth limit reached - Detect same-profile delegation loops (streak >= 2) - Add depth awareness to agent info prompt - Show subordinate status in agent info Made-with: Cursor
Mock agents need explicit max_agent_depth=5 on config to avoid MagicMock vs int comparison errors in depth/loop checks. Update agent info test assertion to include new prompt parameters. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
max_agent_depthtoAgentConfig(default: 5) — hard limit on delegation depthTest plan
test_refuses_at_max_depth— verifies depth limit enforcementtest_allows_under_max_depth— verifies normal delegation workstest_refuses_after_3_same_profile_delegations— verifies loop detectiontest_allows_different_profile— verifies different profiles bypass loop check