fix(decomposition): enforce plan.max-child-depth recursion limit to prevent unbounded hierarchy growth #11248
No reviewers
Labels
No labels
auto/needs-reevaluation
controller-managed
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
#10269 Enforce plan.max-child-depth limit in DecompositionService._build_hierarchy()
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!11248
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/enforce-max-child-depth"
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?
Closes #10269
Summary
Enforces the
plan.max-child-depthconfiguration limit inDecompositionService._build_hierarchy()to prevent unbounded recursive plan decomposition.Changes
DecompositionConfig(decomposition_models.py)max_child_depthfield (default: 5, matchingplan.max-child-depth)__post_init__(value must be >= 1)DecompositionService(decomposition_service.py)max_child_depthguard in_build_hierarchy()depth >= config.max_child_depthDecomposition reached max-child-depth limit (%d) at depth %d. Creating terminal node for %d files.max_depthandmax_child_depthare respected; the more restrictive one winsBDD Tests
features/decomposition_max_child_depth.featureVerification
16c6469d833a95701d9aPR Review — #11248 APPROVED
PR: fix(decomposition): enforce plan.max-child-depth recursion limit to prevent unbounded hierarchy growth
Branch: fix/enforce-max-child-depth
Author: CoreRasurae (Luis Mendes)
Linked Issue: #10269
Milestone: v3.5.0
CI: 12/12 checks green (lint, quality, typecheck, security, build, helm, unit_tests, integration_tests, push-validation, docker, coverage, status-check)
Overall Assessment
All 10 checklist categories pass. The implementation is correct, well-tested, and fully addresses issue #10269. No blocking findings.
Checklist Breakdown
reached_child_depth_limit = depth >= config.max_child_depthcorrectly guards_build_hierarchy(). All 5 acceptance criteria from #10269 are met. The more-restrictive-wins behavior (max_depth vs max_child_depth) is correctly implemented.plan.max-child-depth(default 5) is enforced exactly as described in the spec: recursion stops at the limit, warning log is emitted, and terminal node is created.large_project_decomposition.featureupdated to assertmax_child_depth=5. All 711 features pass with zero failures.# type: ignorecomments. All function signatures annotated. Pydantic v2ConfigDict(arbitrary_types_allowed=True)used appropriately.reached_child_depth_limit). Good docstring. Comment explains M6 4+ level context.reached_child_depth_limitcomputed once per recursion, short-circuits viais_leaf- no inefficiencies.__post_init__validation. No magic numbers.DecompositionConfigdocstring updated withmax_child_depthattribute. No new public API surface.Closes #10269. Appropriately scoped (5 files, 139 additions).Minor Observations (non-blocking, P3)
Unused import (P3:nit):
decomposition_max_child_depth_steps.pyimportswhenfrom behave but only usesthen. Thewhenimport is dead code - suggest removing before merge.Branch naming (P3:nit): The contributing guide specifies
bugfix/mN-for bug fixes; this branch usesfix/. The repo's actual branch history usesfix/universally, so this is consistent with established convention.CI Gate Verification
All 5 required-for-merge CI jobs are green:
CI / lint (pull_request)- Successful in 1m19sCI / typecheck (pull_request)- Successful in 1m43sCI / unit_tests (pull_request)- Successful in 6m36sCI / coverage (pull_request)- Successful in 12m46sCI / security (pull_request)- Successful in 1m56sCoverage job passed with >=97% threshold as confirmed by the
CI / coverage (pull_request)success check.Conclusion
This PR correctly enforces the
plan.max-child-depthconfiguration limit inDecompositionService._build_hierarchy(), preventing unbounded recursive plan decomposition as described in issue #10269. All acceptance criteria pass, all tests pass, and no blocking issues were found. Approved for merge.Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker