fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase #3619
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
1 participant
Notifications
Due date
No due date set.
Blocks
#3561 UAT:
PlanExecutor has no subplan spawning integration — child plans are never spawned during Execute phase
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core!3619
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/m5-plan-executor-subplan-spawning"
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?
Summary
This PR fixes a critical gap in
PlanExecutorwhere subplan spawning was entirely absent from the Execute phase — meaning any plan that recordedsubplan_spawnorsubplan_parallel_spawndecisions during Strategize would silently skip child plan creation and execution. The fix wiresSubplanServiceandSubplanExecutionServiceintoPlanExecutor, fully realising the hierarchical plan execution model defined in the specification.Changes
Injected
SubplanServiceandSubplanExecutionServiceas optional constructor parameters intoPlanExecutor.__init__(). Both default toNoneto preserve full backward compatibility with all existing callers and tests that do not use subplan functionality.Implemented
_spawn_subplans()helper that queries recorded spawn decisions viaSubplanService.get_spawn_decisions()and callsSubplanService.spawn()for each decision, creating the child plan records. When no spawn decisions are present, the method is a no-op.Implemented
_execute_subplans()helper that callsSubplanExecutionService.execute_all(), correctly routing sequentialsubplan_spawndecisions through ordered execution andsubplan_parallel_spawngroups through concurrent execution.Implemented
_apply_subplan_results_to_plan()to propagate child plan failure information back to the parent plan. When one or more child plans fail, the parent plan'serror_detailsfield is annotated with afailed_subplan_idslist so failures are surfaced rather than silently swallowed.Wired
_spawn_subplans()and_execute_subplans()into both execute paths —_run_execute_with_runtime()and_run_execute_with_stub()— so that subplan spawning occurs after actor completion regardless of whether a live runtime or a test stub is in use.Exposed
subplan_serviceandsubplan_execution_serviceproperties onPlanExecutorfor introspection and testability.Added Behave feature file with 6 scenarios covering: sequential
subplan_spawnrealisation, concurrentsubplan_parallel_spawngroup execution, no-op behaviour when no spawn decisions are recorded, and parent plan failure tracking when a child plan fails.Added Robot Framework integration test suite with 6 test cases validating end-to-end subplan spawning.
Design Decisions
Optional service injection (backward compatibility): Both services are injected as optional parameters (
Noneby default). When either is absent, all spawning logic is skipped entirely.No-op on empty spawn decisions:
_spawn_subplans()returns early when no spawn decisions are found.Failure annotation rather than immediate abort: When child plans fail, the parent plan's
error_detailsis annotated withfailed_subplan_idsrather than immediately raising an exception.Shared spawning logic across runtime and stub paths: Both
_run_execute_with_runtime()and_run_execute_with_stub()delegate to the same helpers.Testing
Closes #3561
Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker
Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-pr-api-creator
PlanExecutorhas no subplan spawning integration — child plans are never spawned during Execute phasePlanExecutorhas no subplan spawning integration — child plans are never spawned during Execute phase #3561Code Review — PR #3619
Focus Areas: specification-compliance, test-coverage-quality, error-handling-patterns
VERDICT: APPROVE ✅
Overview
This PR correctly wires
SubplanServiceandSubplanExecutionServiceintoPlanExecutor, realising the hierarchical plan execution model defined in the specification. The implementation is well-designed with proper backward compatibility.✅ Specification Compliance
_spawn_subplans()correctly queriesSubplanService.get_spawn_decisions()and callsSubplanService.spawn()for each decision — matches the spec's hierarchical plan model._execute_subplans()correctly routessubplan_spawnthrough ordered execution andsubplan_parallel_spawngroups through concurrent execution._apply_subplan_results_to_plan()annotates parent plan'serror_detailswithfailed_subplan_ids— correct fail-safe behavior.fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase— follows Conventional Changelog format ✅Closes #3561✅Type/Bug✅✅ Test Coverage Quality
_run_execute_with_runtime()and_run_execute_with_stub()both wired✅ Error Handling Patterns
None— when absent, all spawning logic is skipped. Correct fail-safe pattern._spawn_subplans()returns early when no spawn decisions found — correct.error_detailsannotated withfailed_subplan_ids— allows caller to inspect failures without masking the original error.None).✅ Quality Gates
Non-blocking Observations
_execute_subplans()routessubplan_parallel_spawnthrough concurrent execution. VerifySubplanExecutionService.execute_all()is thread-safe for concurrent invocations.This PR is ready to merge.
Automated by CleverAgents Bot
Supervisor: PR Review | Agent: ca-continuous-pr-reviewer
PlanExecutorhas no subplan spawning integration — child plans are never spawned during Execute phase #3561