Files
cleveragents-core/robot/plan_executor_subplan_spawning.robot
T
freemo 8608584e99
CI / lint (pull_request) Successful in 38s
CI / typecheck (pull_request) Successful in 54s
CI / quality (pull_request) Successful in 39s
CI / security (pull_request) Successful in 1m4s
CI / build (pull_request) Successful in 28s
CI / helm (pull_request) Successful in 24s
CI / unit_tests (pull_request) Failing after 6m49s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m47s
CI / coverage (pull_request) Successful in 11m21s
CI / integration_tests (pull_request) Failing after 23m41s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 56m59s
fix(plan-executor): wire SubplanService and SubplanExecutionService into Execute phase
Implemented optional SubplanService and SubplanExecutionService wiring in PlanExecutor.__init__() (None = no-op).
- Added _spawn_subplans() helper:
  - Queries spawn decisions via SubplanService.get_spawn_decisions() and calls SubplanService.spawn() for each decision.
  - No-ops when there are no spawn decisions.
- Added _execute_subplans() helper:
  - Delegates to SubplanExecutionService.execute_all() to run spawned subplans, handling both sequential and parallel groups as dictated by decisions.
- Added _apply_subplan_results_to_plan() helper:
  - Updates parent plan status tracking when child subplans fail.
  - Annotates error_details with failed_subplan_ids when appropriate.
- Integrated spawning and execution into existing flow:
  - Called _spawn_subplans() and _execute_subplans() from both _run_execute_with_runtime() and _run_execute_with_stub() after actor completion.
- Introduced PlanExecutor properties:
  - subplan_service and subplan_execution_service for external wiring and testability.
- Added tests and scenarios:
  - Behave feature file with 6 scenarios covering subplan_spawn, subplan_parallel_spawn, no-op, and failure tracking.
  - Robot Framework integration test suite with 6 end-to-end subplan spawning test cases.

Key design decisions
- Optional services (None = no-op) to maintain backward compatibility with existing deployments.
- Subplan spawning is a no-op when no spawn decisions exist, avoiding unnecessary work.
- Parent plan error_details is annotated with failed_subplan_ids when a child subplan fails to aid debugging and traceability.
- Both runtime and stub execute paths share the same spawning logic to ensure consistent behavior across execution modes.

ISSUES CLOSED: #3561
2026-04-05 20:46:24 +00:00

56 lines
3.1 KiB
Plaintext

*** Settings ***
Documentation Integration tests for PlanExecutor subplan spawning.
... Verifies that subplan_spawn and subplan_parallel_spawn
... decisions are realised as actual child plan executions
... during the Execute phase (Forgejo #3561).
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} robot/helper_plan_executor_subplan_spawning.py
*** Test Cases ***
Subplan Spawn Decision Realisation
[Documentation] Verify subplan_spawn decision triggers SubplanService.spawn
... and SubplanExecutionService.execute_all during Execute phase
[Tags] plan execute subplan spawn integration
${result}= Run Process ${PYTHON} ${HELPER} spawn-decision-realisation cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} spawn-decision-realisation-ok
Parallel Subplan Spawn Decision Realisation
[Documentation] Verify subplan_parallel_spawn decision triggers parallel execution
[Tags] plan execute subplan spawn parallel integration
${result}= Run Process ${PYTHON} ${HELPER} parallel-spawn-decision-realisation cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} parallel-spawn-decision-realisation-ok
No-Op When No Spawn Decisions
[Documentation] Verify execute phase is a no-op for subplans when no spawn decisions exist
[Tags] plan execute subplan noop integration
${result}= Run Process ${PYTHON} ${HELPER} noop-no-spawn-decisions cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} noop-no-spawn-decisions-ok
No-Op When SubplanService Not Configured
[Documentation] Verify execute phase completes normally when SubplanService is absent
[Tags] plan execute subplan noop integration
${result}= Run Process ${PYTHON} ${HELPER} noop-no-subplan-service cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} noop-no-subplan-service-ok
Parent Plan Status Tracking On Child Failure
[Documentation] Verify parent plan error_details records failed subplan IDs
[Tags] plan execute subplan failure integration
${result}= Run Process ${PYTHON} ${HELPER} parent-status-tracking-failure cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} parent-status-tracking-failure-ok
SubplanService Properties Exposed
[Documentation] Verify PlanExecutor exposes subplan_service and subplan_execution_service properties
[Tags] plan execute subplan properties integration
${result}= Run Process ${PYTHON} ${HELPER} subplan-service-properties cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} subplan-service-properties-ok