Wire SubplanExecutionService in CLI _get_plan_executor() to enable child plan execution #10268

Closed
opened 2026-04-17 18:27:02 +00:00 by CoreRasurae · 1 comment
Member

Wire SubplanExecutionService in CLI _get_plan_executor()

Metadata

  • Commit Message: fix(cli): wire SubplanExecutionService in _get_plan_executor() to enable child plan execution
  • Branch: fix/wire-subplan-execution-service

Background and Context

The SubplanExecutionService is designed to execute spawned child plans in the hierarchical planning system per v3.5.0 acceptance criteria. However, the CLI's _get_plan_executor() function (line 1668-1750 in src/cleveragents/cli/commands/plan.py) does not instantiate or pass this service to PlanExecutor, leaving it as None.

This means:

  • Child plan execution is completely disabled in the production CLI path
  • PlanExecutor.execute_spawned_plans() immediately returns None due to the guard: if self._subplan_execution_service is None: return None
  • Only test mocks that explicitly wire SubplanExecutionService can execute child plans
  • The hierarchical execution feature from PR #1175 (Strategy Actor) cannot complete without this wiring

Reference: docs/specification.md §CheckpointService Operations (line 19455+) specifies that SubplanExecutionService should handle the on_subplan_spawn checkpoint trigger.


Current Behavior

# src/cleveragents/cli/commands/plan.py:_get_plan_executor() (lines ~1720-1735)
return PlanExecutor(
    lifecycle_service=lifecycle_service,
    strategize_actor=strategize_actor,
    execute_actor=execute_actor,
    sandbox_root=sandbox_root,
    # ❌ Missing: subplan_execution_service parameter
)

Result: PlanExecutor._subplan_execution_service is None → child plans cannot execute.


Expected Behavior

# src/cleveragents/cli/commands/plan.py:_get_plan_executor() (corrected)
subplan_execution_service = container.subplan_execution_service()

return PlanExecutor(
    lifecycle_service=lifecycle_service,
    strategize_actor=strategize_actor,
    execute_actor=execute_actor,
    sandbox_root=sandbox_root,
    subplan_execution_service=subplan_execution_service,  # ✅ Wired
)

Result: Child plans can execute through the production agents plan execute CLI command.


Acceptance Criteria

  1. SubplanExecutionService is instantiated from the DI container in _get_plan_executor()
  2. SubplanExecutionService is passed to the PlanExecutor constructor with the executor_fn parameter bound to a proper child plan executor callback
  3. The executor_fn correctly invokes the full 4-phase lifecycle (Strategize→Decompose→Execute→Validate) for each child plan
  4. Child plans respect the parent plan's plan.max-child-depth configuration limit
  5. Checkpoint triggers (on_subplan_spawn) are properly invoked before first child plan execution
  6. All existing tests continue to pass
  7. New BDD scenario added: "agents plan execute spawns and executes child plans successfully"

Subtasks

  • Modify _get_plan_executor() to instantiate and wire SubplanExecutionService from the container
  • Create or bind the executor_fn callback to properly execute child plans through the full 4-phase lifecycle
  • Add BDD scenario in features/plan_execution_hierarchical.feature: "CLI execute command spawns and executes child plans with checkpoint creation"
  • Implement step definitions for the hierarchical execution scenario
  • Run nox -e unit_tests to verify all Behave tests pass
  • Run nox -e integration_tests (Robot Framework) to verify no regressions
  • Verify coverage >=97% via nox -s coverage_report
  • Run full nox to verify all quality gates pass

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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 implementation details.
  • The commit is pushed to the remote on the fix/wire-subplan-execution-service branch.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All quality gates pass: nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e integration_tests, and coverage >=97%.
# Wire SubplanExecutionService in CLI _get_plan_executor() ## Metadata - **Commit Message**: `fix(cli): wire SubplanExecutionService in _get_plan_executor() to enable child plan execution` - **Branch**: `fix/wire-subplan-execution-service` --- ## Background and Context The `SubplanExecutionService` is designed to execute spawned child plans in the hierarchical planning system per v3.5.0 acceptance criteria. However, the CLI's `_get_plan_executor()` function (line 1668-1750 in `src/cleveragents/cli/commands/plan.py`) does **not** instantiate or pass this service to `PlanExecutor`, leaving it as `None`. This means: - Child plan execution is completely disabled in the production CLI path - `PlanExecutor.execute_spawned_plans()` immediately returns `None` due to the guard: `if self._subplan_execution_service is None: return None` - Only test mocks that explicitly wire SubplanExecutionService can execute child plans - The hierarchical execution feature from PR #1175 (Strategy Actor) cannot complete without this wiring **Reference**: `docs/specification.md` §CheckpointService Operations (line 19455+) specifies that `SubplanExecutionService` should handle the `on_subplan_spawn` checkpoint trigger. --- ## Current Behavior ```python # src/cleveragents/cli/commands/plan.py:_get_plan_executor() (lines ~1720-1735) return PlanExecutor( lifecycle_service=lifecycle_service, strategize_actor=strategize_actor, execute_actor=execute_actor, sandbox_root=sandbox_root, # ❌ Missing: subplan_execution_service parameter ) ``` Result: `PlanExecutor._subplan_execution_service` is `None` → child plans cannot execute. --- ## Expected Behavior ```python # src/cleveragents/cli/commands/plan.py:_get_plan_executor() (corrected) subplan_execution_service = container.subplan_execution_service() return PlanExecutor( lifecycle_service=lifecycle_service, strategize_actor=strategize_actor, execute_actor=execute_actor, sandbox_root=sandbox_root, subplan_execution_service=subplan_execution_service, # ✅ Wired ) ``` Result: Child plans can execute through the production `agents plan execute` CLI command. --- ## Acceptance Criteria 1. `SubplanExecutionService` is instantiated from the DI container in `_get_plan_executor()` 2. `SubplanExecutionService` is passed to the `PlanExecutor` constructor with the `executor_fn` parameter bound to a proper child plan executor callback 3. The executor_fn correctly invokes the full 4-phase lifecycle (Strategize→Decompose→Execute→Validate) for each child plan 4. Child plans respect the parent plan's `plan.max-child-depth` configuration limit 5. Checkpoint triggers (`on_subplan_spawn`) are properly invoked before first child plan execution 6. All existing tests continue to pass 7. New BDD scenario added: "agents plan execute spawns and executes child plans successfully" --- ## Subtasks - [ ] Modify `_get_plan_executor()` to instantiate and wire `SubplanExecutionService` from the container - [ ] Create or bind the `executor_fn` callback to properly execute child plans through the full 4-phase lifecycle - [ ] Add BDD scenario in `features/plan_execution_hierarchical.feature`: "CLI execute command spawns and executes child plans with checkpoint creation" - [ ] Implement step definitions for the hierarchical execution scenario - [ ] Run `nox -e unit_tests` to verify all Behave tests pass - [ ] Run `nox -e integration_tests` (Robot Framework) to verify no regressions - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run full `nox` to verify all quality gates pass --- ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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 implementation details. - The commit is pushed to the remote on the `fix/wire-subplan-execution-service` branch. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All quality gates pass: `nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e integration_tests`, and coverage >=97%.
HAL9000 added this to the v3.5.0 milestone 2026-04-18 07:57:42 +00:00
Owner

[GROOMED] Quality Analysis Complete

Grooming Summary

Validity Assessment

This is a VALID, ACTIONABLE issue with clear requirements and acceptance criteria.

Required Labels Check

  • State/: State/Unverified (present)
  • Type/: Type/Task
  • Priority/: Priority/High

Milestone Assignment

  • Assigned to: v3.5.0 (M6: Autonomy Hardening)

Actions Taken

  1. Assigned to v3.5.0 milestone
  2. ⚠️ State label transition needs manual update to State/Verified

Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-pool-supervisor

[GROOMED] Quality Analysis Complete ## Grooming Summary ### Validity Assessment This is a VALID, ACTIONABLE issue with clear requirements and acceptance criteria. ### Required Labels Check - State/: State/Unverified (present) - Type/: Type/Task ✅ - Priority/: Priority/High ✅ ### Milestone Assignment - Assigned to: v3.5.0 (M6: Autonomy Hardening) ✅ ### Actions Taken 1. ✅ Assigned to v3.5.0 milestone 2. ⚠️ State label transition needs manual update to State/Verified --- **Automated by CleverAgents Bot** Supervisor: Grooming | Agent: grooming-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#10268
No description provided.