UAT: PlanExecutor has no subplan spawning integration — child plans are never spawned during Execute phase #3561

Closed
opened 2026-04-05 19:42:54 +00:00 by freemo · 4 comments
Owner

Background and Context

The specification defines that child plans are spawned during the Execute phase based on subplan_spawn and subplan_parallel_spawn decisions recorded during the Strategize phase. The builtin/plan-subplan tool is responsible for recording these decisions, and PlanExecutor is responsible for realising them as actual child plan executions.

However, PlanExecutor (src/cleveragents/application/services/plan_executor.py) contains zero references to SubplanService, SubplanExecutionService, or any subplan spawning logic. The entire hierarchical plan execution model is therefore non-functional: any plan that uses subplan_spawn or subplan_parallel_spawn decisions will silently skip child plan execution with no error or warning.

Current Behavior

PlanExecutor.run_execute() (line 577), _run_execute_with_runtime() (line 661), and _run_execute_with_stub() (line 726) contain no calls to SubplanService.spawn() or SubplanExecutionService.execute_all().

  • src/cleveragents/application/services/subplan_service.pySubplanService.spawn() exists but is never called from PlanExecutor
  • src/cleveragents/application/services/subplan_execution_service.pySubplanExecutionService.execute_all() exists but is never called from PlanExecutor

The builtin/plan-subplan tool records subplan_spawn and subplan_parallel_spawn decisions to the database, but those decisions are never acted upon — no child plans are ever created or executed.

Steps to reproduce:

  1. Create a plan with a strategy actor that calls builtin/plan-subplan to emit a subplan_spawn decision
  2. Run agents plan execute <plan_id>
  3. Observe that no child plans are created or executed despite the decision being recorded in the database

Expected Behavior

Per the specification, after the Execute phase actor completes:

Child plans are actually spawned during Execute (based on those decisions). subplan_spawn decisions are realized as actual child plans, and subplan_parallel_spawn groups trigger concurrent spawning of all enclosed child plans.

PlanExecutor.run_execute() must:

  1. Query spawn decisions via SubplanService.get_spawn_decisions() after the actor completes
  2. Call SubplanService.spawn() to create child plan records for each subplan_spawn decision
  3. Call SubplanExecutionService.execute_all() to execute them — sequentially for subplan_spawn, concurrently for subplan_parallel_spawn groups

Acceptance Criteria

  • PlanExecutor.run_execute() queries subplan spawn decisions after actor completion
  • Sequential subplan_spawn decisions result in child plans being created and executed in order
  • subplan_parallel_spawn groups result in child plans being created and executed concurrently
  • Parent plan correctly tracks all child subplan statuses
  • If a child plan fails, the parent plan surfaces the failure appropriately
  • No child plan spawning is attempted when no spawn decisions are recorded
  • All existing PlanExecutor tests continue to pass

Supporting Information

Affected code locations:

  • src/cleveragents/application/services/plan_executor.pyrun_execute() (line 577), _run_execute_with_runtime() (line 661), _run_execute_with_stub() (line 726)
  • src/cleveragents/application/services/subplan_service.pySubplanService.spawn() (exists, unused from executor)
  • src/cleveragents/application/services/subplan_execution_service.pySubplanExecutionService.execute_all() (exists, unused from executor)

Suggested fix:
Wire SubplanService and SubplanExecutionService into PlanExecutor. After the strategy/execute actor completes in run_execute(), query spawn decisions, call SubplanService.spawn() to create child plans, then call SubplanExecutionService.execute_all() to run them — using concurrent execution for subplan_parallel_spawn groups.

Impact: Critical — the entire hierarchical plan execution model is non-functional. Any plan using subplan decisions silently skips child plan execution.

Metadata

  • Branch: fix/m5-plan-executor-subplan-spawning
  • Commit Message: fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase
  • Milestone: v3.4.0
  • Parent Epic: #368

Subtasks

  • Inject SubplanService and SubplanExecutionService into PlanExecutor.__init__()
  • Implement _spawn_subplans() helper in PlanExecutor that queries spawn decisions and calls SubplanService.spawn() for each
  • Implement _execute_subplans() helper that calls SubplanExecutionService.execute_all(), handling sequential vs. parallel groups
  • Call _spawn_subplans() and _execute_subplans() from run_execute() after actor completion
  • Ensure _run_execute_with_runtime() and _run_execute_with_stub() both route through the new spawning logic
  • Handle parent plan status tracking for child subplan failures
  • Tests (Behave): Add scenarios for subplan_spawn decision realisation in PlanExecutor
  • Tests (Behave): Add scenarios for subplan_parallel_spawn concurrent execution in PlanExecutor
  • Tests (Behave): Add scenario for no-op when no spawn decisions are recorded
  • Tests (Robot): Add integration test for end-to-end subplan spawning via agents plan execute
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • PlanExecutor.run_execute() correctly realises subplan_spawn and subplan_parallel_spawn decisions as actual child plan executions.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Automated by CleverAgents Bot
Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Background and Context The specification defines that child plans are spawned during the Execute phase based on `subplan_spawn` and `subplan_parallel_spawn` decisions recorded during the Strategize phase. The `builtin/plan-subplan` tool is responsible for recording these decisions, and `PlanExecutor` is responsible for realising them as actual child plan executions. However, `PlanExecutor` (`src/cleveragents/application/services/plan_executor.py`) contains **zero references** to `SubplanService`, `SubplanExecutionService`, or any subplan spawning logic. The entire hierarchical plan execution model is therefore non-functional: any plan that uses `subplan_spawn` or `subplan_parallel_spawn` decisions will silently skip child plan execution with no error or warning. ## Current Behavior `PlanExecutor.run_execute()` (line 577), `_run_execute_with_runtime()` (line 661), and `_run_execute_with_stub()` (line 726) contain no calls to `SubplanService.spawn()` or `SubplanExecutionService.execute_all()`. - `src/cleveragents/application/services/subplan_service.py` — `SubplanService.spawn()` exists but is **never called** from `PlanExecutor` - `src/cleveragents/application/services/subplan_execution_service.py` — `SubplanExecutionService.execute_all()` exists but is **never called** from `PlanExecutor` The `builtin/plan-subplan` tool records `subplan_spawn` and `subplan_parallel_spawn` decisions to the database, but those decisions are never acted upon — no child plans are ever created or executed. **Steps to reproduce:** 1. Create a plan with a strategy actor that calls `builtin/plan-subplan` to emit a `subplan_spawn` decision 2. Run `agents plan execute <plan_id>` 3. Observe that no child plans are created or executed despite the decision being recorded in the database ## Expected Behavior Per the specification, after the Execute phase actor completes: > Child plans are actually spawned during Execute (based on those decisions). `subplan_spawn` decisions are realized as actual child plans, and `subplan_parallel_spawn` groups trigger concurrent spawning of all enclosed child plans. `PlanExecutor.run_execute()` must: 1. Query spawn decisions via `SubplanService.get_spawn_decisions()` after the actor completes 2. Call `SubplanService.spawn()` to create child plan records for each `subplan_spawn` decision 3. Call `SubplanExecutionService.execute_all()` to execute them — sequentially for `subplan_spawn`, concurrently for `subplan_parallel_spawn` groups ## Acceptance Criteria - [ ] `PlanExecutor.run_execute()` queries subplan spawn decisions after actor completion - [ ] Sequential `subplan_spawn` decisions result in child plans being created and executed in order - [ ] `subplan_parallel_spawn` groups result in child plans being created and executed concurrently - [ ] Parent plan correctly tracks all child subplan statuses - [ ] If a child plan fails, the parent plan surfaces the failure appropriately - [ ] No child plan spawning is attempted when no spawn decisions are recorded - [ ] All existing `PlanExecutor` tests continue to pass ## Supporting Information **Affected code locations:** - `src/cleveragents/application/services/plan_executor.py` — `run_execute()` (line 577), `_run_execute_with_runtime()` (line 661), `_run_execute_with_stub()` (line 726) - `src/cleveragents/application/services/subplan_service.py` — `SubplanService.spawn()` (exists, unused from executor) - `src/cleveragents/application/services/subplan_execution_service.py` — `SubplanExecutionService.execute_all()` (exists, unused from executor) **Suggested fix:** Wire `SubplanService` and `SubplanExecutionService` into `PlanExecutor`. After the strategy/execute actor completes in `run_execute()`, query spawn decisions, call `SubplanService.spawn()` to create child plans, then call `SubplanExecutionService.execute_all()` to run them — using concurrent execution for `subplan_parallel_spawn` groups. **Impact:** Critical — the entire hierarchical plan execution model is non-functional. Any plan using subplan decisions silently skips child plan execution. ## Metadata - **Branch**: `fix/m5-plan-executor-subplan-spawning` - **Commit Message**: `fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase` - **Milestone**: v3.4.0 - **Parent Epic**: #368 ## Subtasks - [ ] Inject `SubplanService` and `SubplanExecutionService` into `PlanExecutor.__init__()` - [ ] Implement `_spawn_subplans()` helper in `PlanExecutor` that queries spawn decisions and calls `SubplanService.spawn()` for each - [ ] Implement `_execute_subplans()` helper that calls `SubplanExecutionService.execute_all()`, handling sequential vs. parallel groups - [ ] Call `_spawn_subplans()` and `_execute_subplans()` from `run_execute()` after actor completion - [ ] Ensure `_run_execute_with_runtime()` and `_run_execute_with_stub()` both route through the new spawning logic - [ ] Handle parent plan status tracking for child subplan failures - [ ] Tests (Behave): Add scenarios for `subplan_spawn` decision realisation in `PlanExecutor` - [ ] Tests (Behave): Add scenarios for `subplan_parallel_spawn` concurrent execution in `PlanExecutor` - [ ] Tests (Behave): Add scenario for no-op when no spawn decisions are recorded - [ ] Tests (Robot): Add integration test for end-to-end subplan spawning via `agents plan execute` - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `PlanExecutor.run_execute()` correctly realises `subplan_spawn` and `subplan_parallel_spawn` decisions as actual child plan executions. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.4.0 milestone 2026-04-05 19:43:02 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical — The entire hierarchical plan execution model is non-functional. SubplanService.spawn() and SubplanExecutionService.execute_all() exist but are never called from PlanExecutor. Any plan using subplan decisions silently skips child plan execution with no error or warning. This is a fundamental architectural gap.
  • Milestone: v3.4.0 (already set, correct — Subplans & Parallelism is the core scope of M5/v3.4.0)
  • Story Points: 8 — XL — Requires injecting two services into PlanExecutor, implementing spawn and execute helpers, handling sequential vs. parallel groups, parent status tracking, failure propagation, plus comprehensive Behave and Robot Framework tests.
  • MoSCoW: Must Have — The spec defines subplan spawning as a core capability of the Execute phase. Without it, hierarchical plan execution is completely non-functional. This is a milestone-defining feature for v3.4.0.
  • Parent Epic: #368 (Subplans & Parallelism)

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical — The entire hierarchical plan execution model is non-functional. `SubplanService.spawn()` and `SubplanExecutionService.execute_all()` exist but are never called from `PlanExecutor`. Any plan using subplan decisions silently skips child plan execution with no error or warning. This is a fundamental architectural gap. - **Milestone**: v3.4.0 (already set, correct — Subplans & Parallelism is the core scope of M5/v3.4.0) - **Story Points**: 8 — XL — Requires injecting two services into PlanExecutor, implementing spawn and execute helpers, handling sequential vs. parallel groups, parent status tracking, failure propagation, plus comprehensive Behave and Robot Framework tests. - **MoSCoW**: Must Have — The spec defines subplan spawning as a core capability of the Execute phase. Without it, hierarchical plan execution is completely non-functional. This is a milestone-defining feature for v3.4.0. - **Parent Epic**: #368 (Subplans & Parallelism) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Label compliance fix applied:

  • Added missing label: Priority/Critical
  • Added missing label: Type/Bug
  • Reason: Issue was missing required Priority/* and Type/* labels per CONTRIBUTING.md. Inferred Type/Bug from UAT issue title (critical missing functionality). Applied Priority/Critical based on the issue body context ("Critical — the entire hierarchical plan execution model is non-functional").

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: ca-backlog-groomer

Label compliance fix applied: - Added missing label: `Priority/Critical` - Added missing label: `Type/Bug` - Reason: Issue was missing required Priority/* and Type/* labels per CONTRIBUTING.md. Inferred `Type/Bug` from UAT issue title (critical missing functionality). Applied `Priority/Critical` based on the issue body context ("Critical — the entire hierarchical plan execution model is non-functional"). --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
Author
Owner

PR #3619 created on branch fix/m5-plan-executor-subplan-spawning. I will monitor and handle all review feedback until merged.

Implementation summary:

  • Injected SubplanService and SubplanExecutionService into PlanExecutor.__init__() as optional parameters
  • Implemented _spawn_subplans(), _execute_subplans(), and _apply_subplan_results_to_plan() helpers
  • Wired subplan spawning into both _run_execute_with_runtime() and _run_execute_with_stub() after actor completion
  • Added 6 Behave scenarios and 6 Robot Framework integration tests — all passing
  • Lint and typecheck: clean

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3619 created on branch `fix/m5-plan-executor-subplan-spawning`. I will monitor and handle all review feedback until merged. **Implementation summary:** - Injected `SubplanService` and `SubplanExecutionService` into `PlanExecutor.__init__()` as optional parameters - Implemented `_spawn_subplans()`, `_execute_subplans()`, and `_apply_subplan_results_to_plan()` helpers - Wired subplan spawning into both `_run_execute_with_runtime()` and `_run_execute_with_stub()` after actor completion - Added 6 Behave scenarios and 6 Robot Framework integration tests — all passing - Lint and typecheck: clean --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

PR #3619 has been merged successfully! 🎉

Summary:

  • PR was reviewed and approved by the automated reviewer (VERDICT: APPROVE )
  • Merged by @freemo at 2026-04-05T21:06:48Z
  • Merge commit: 3abeef3a19baa9041fbec14f67e2185d56049ccc

CI Results at merge time:

  • lint — passed
  • typecheck — passed
  • security — passed
  • quality — passed
  • build — passed
  • helm — passed
  • docker — skipped (not required)
  • ⚠️ unit_tests — pre-existing failure on master (unrelated to this PR; same failure exists on master branch)

The unit_tests CI failure is a pre-existing issue on master caused by a Python 3.13 / ulid-py compatibility bug in features/steps/checkpoint_service_coverage_boost_steps.py (introduced in commit 051ee7c2). This is not related to the subplan spawning changes in this PR.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3619 has been merged successfully! 🎉 **Summary:** - PR was reviewed and approved by the automated reviewer (VERDICT: APPROVE ✅) - Merged by @freemo at 2026-04-05T21:06:48Z - Merge commit: `3abeef3a19baa9041fbec14f67e2185d56049ccc` **CI Results at merge time:** - ✅ lint — passed - ✅ typecheck — passed - ✅ security — passed - ✅ quality — passed - ✅ build — passed - ✅ helm — passed - ✅ docker — skipped (not required) - ⚠️ unit_tests — pre-existing failure on master (unrelated to this PR; same failure exists on master branch) The `unit_tests` CI failure is a pre-existing issue on master caused by a Python 3.13 / `ulid-py` compatibility bug in `features/steps/checkpoint_service_coverage_boost_steps.py` (introduced in commit `051ee7c2`). This is not related to the subplan spawning changes in this PR. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
freemo removed this from the v3.4.0 milestone 2026-04-06 21:04:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#3561
No description provided.