TDD: subplan spawn creates metadata but does not orchestrate real child plan execution (bug #823) #838

Closed
opened 2026-03-13 21:15:11 +00:00 by freemo · 4 comments
Owner

Background and Context

Bug #823 (bug(plan): subplan spawn creates metadata but does not orchestrate real child plan execution) identifies a defect where SubplanService.spawn() only creates metadata (a SubplanRecord) but does not create a real child Plan domain object, trigger the child plan's lifecycle, set up inter-plan communication, merge results, or handle failures. Per the mandatory TDD bug-fix workflow (CONTRIBUTING.md §Bug Fix Workflow), a failing test must be written before the fix is implemented.

This issue tracks the TDD test-writing phase for bug #823.

Current Behavior

No test exists that verifies subplan spawn actually orchestrates real child plan execution through the full lifecycle (strategize → execute → validate → complete).

Expected Behavior

A Behave BDD scenario and/or Robot Framework test tagged with @tdd_expected_fail, @tdd_bug, and @tdd_bug_823 should exist that:

  1. Spawns a subplan via SubplanService.spawn()
  2. Asserts the child plan enters the strategize phase and progresses through the full lifecycle
  3. Asserts parent plan tracks child plan status
  4. Currently fails (proving the bug exists), but passes CI via the @tdd_expected_fail inversion

Acceptance Criteria

  • At least one Behave scenario in features/tdd_subplan_spawn_orchestration.feature
  • Scenario tagged with @tdd_expected_fail @tdd_bug @tdd_bug_823
  • At least one Robot Framework test in robot/tdd_subplan_spawn_orchestration.robot
  • Test tagged with tdd_expected_fail, tdd_bug, tdd_bug_823
  • Full test suite passes (nox -s unit_tests integration_tests)
  • ruff check and ruff format pass

Metadata

  • Commit message: test(plan): TDD failing tests for subplan spawn orchestration (bug #823)
  • Branch name: tdd/m6-subplan-spawn-orchestration
  • Type: Testing
  • Priority: Critical
  • MoSCoW: Must have
  • Points: 2
  • Milestone: v3.5.0

Subtasks

  • Write Behave scenario exercising subplan spawn → lifecycle progression
  • Write Robot Framework test exercising subplan execution end-to-end
  • Apply @tdd_expected_fail tags
  • Verify tests fail (bug present) but CI passes (inversion working)

Definition of Done

  • TDD tests exist and are tagged correctly
  • Tests demonstrate the bug (fail without @tdd_expected_fail)
  • Full CI suite passes with the inversion
  • PR merged to master
## Background and Context Bug #823 (`bug(plan): subplan spawn creates metadata but does not orchestrate real child plan execution`) identifies a defect where `SubplanService.spawn()` only creates metadata (a SubplanRecord) but does not create a real child `Plan` domain object, trigger the child plan's lifecycle, set up inter-plan communication, merge results, or handle failures. Per the mandatory TDD bug-fix workflow (CONTRIBUTING.md §Bug Fix Workflow), a failing test must be written **before** the fix is implemented. This issue tracks the TDD test-writing phase for bug #823. ## Current Behavior No test exists that verifies subplan spawn actually orchestrates real child plan execution through the full lifecycle (strategize → execute → validate → complete). ## Expected Behavior A Behave BDD scenario and/or Robot Framework test tagged with `@tdd_expected_fail`, `@tdd_bug`, and `@tdd_bug_823` should exist that: 1. Spawns a subplan via `SubplanService.spawn()` 2. Asserts the child plan enters the strategize phase and progresses through the full lifecycle 3. Asserts parent plan tracks child plan status 4. Currently **fails** (proving the bug exists), but passes CI via the `@tdd_expected_fail` inversion ## Acceptance Criteria - [x] At least one Behave scenario in `features/tdd_subplan_spawn_orchestration.feature` - [x] Scenario tagged with `@tdd_expected_fail @tdd_bug @tdd_bug_823` - [x] At least one Robot Framework test in `robot/tdd_subplan_spawn_orchestration.robot` - [x] Test tagged with `tdd_expected_fail`, `tdd_bug`, `tdd_bug_823` - [x] Full test suite passes (`nox -s unit_tests integration_tests`) - [x] `ruff check` and `ruff format` pass ## Metadata - **Commit message**: `test(plan): TDD failing tests for subplan spawn orchestration (bug #823)` - **Branch name**: `tdd/m6-subplan-spawn-orchestration` - **Type**: Testing - **Priority**: Critical - **MoSCoW**: Must have - **Points**: 2 - **Milestone**: v3.5.0 ## Subtasks - [x] Write Behave scenario exercising subplan spawn → lifecycle progression - [x] Write Robot Framework test exercising subplan execution end-to-end - [x] Apply `@tdd_expected_fail` tags - [x] Verify tests fail (bug present) but CI passes (inversion working) ## Definition of Done - TDD tests exist and are tagged correctly - Tests demonstrate the bug (fail without `@tdd_expected_fail`) - Full CI suite passes with the inversion - PR merged to `master`
freemo added this to the v3.5.0 milestone 2026-03-13 21:15:56 +00:00
Member

Implementation Notes

Design Decisions

Behave scenario structure: Three scenarios covering the three main aspects of the bug:

  1. Spawn returns child Plan objects — Calls SubplanService.spawn() and asserts that SpawnResult contains actual Plan domain objects. Fails because SpawnResult only has spawned_statuses (SubplanStatus metadata) and metadata (SpawnMetadata) — no child_plans attribute exists.
  2. Child plans enter strategize phase — Asserts child plans progress through the lifecycle after spawn. Fails because no child Plan objects are created.
  3. Parent plan tracks child status — Asserts the parent plan's subplan_statuses list is populated after spawn. Fails because spawn() returns status entries in SpawnResult but does not attach them to the parent plan.

Robot test structure: Mirrors the Behave scenarios using the established Run Process + sentinel pattern. Python helper (helper_tdd_subplan_spawn_orchestration.py) imports domain models and services directly to set up parent plan, spawn config, and spawn entries.

Tag compliance: All scenarios carry @tdd_expected_fail @tdd_bug @tdd_bug_823 @mock_only. Robot tests carry tdd_expected_fail, tdd_bug, tdd_bug_823. Inversion works correctly — tests fail (proving bug exists) but CI reports them as passed.

Verification Results

Nox Session Result
lint PASS
typecheck PASS (0 errors)
unit_tests PASS (380 features, 10809 scenarios)
coverage_report 98% (>= 97% threshold)

Files Created

File Lines Purpose
features/tdd_subplan_spawn_orchestration.feature 34 3 Behave scenarios
features/steps/tdd_subplan_spawn_orchestration_steps.py 246 Step definitions with full type annotations
robot/tdd_subplan_spawn_orchestration.robot 44 3 Robot test cases
robot/helper_tdd_subplan_spawn_orchestration.py 250 Python helper with 3 subcommands

Commit

a0bd2ca63fd5bb415712ab763889f37c2c143774 on branch tdd/m6-subplan-spawn-orchestration

## Implementation Notes ### Design Decisions **Behave scenario structure:** Three scenarios covering the three main aspects of the bug: 1. **Spawn returns child Plan objects** — Calls `SubplanService.spawn()` and asserts that `SpawnResult` contains actual `Plan` domain objects. Fails because `SpawnResult` only has `spawned_statuses` (SubplanStatus metadata) and `metadata` (SpawnMetadata) — no `child_plans` attribute exists. 2. **Child plans enter strategize phase** — Asserts child plans progress through the lifecycle after spawn. Fails because no child Plan objects are created. 3. **Parent plan tracks child status** — Asserts the parent plan's `subplan_statuses` list is populated after spawn. Fails because `spawn()` returns status entries in `SpawnResult` but does not attach them to the parent plan. **Robot test structure:** Mirrors the Behave scenarios using the established `Run Process` + sentinel pattern. Python helper (`helper_tdd_subplan_spawn_orchestration.py`) imports domain models and services directly to set up parent plan, spawn config, and spawn entries. **Tag compliance:** All scenarios carry `@tdd_expected_fail @tdd_bug @tdd_bug_823 @mock_only`. Robot tests carry `tdd_expected_fail`, `tdd_bug`, `tdd_bug_823`. Inversion works correctly — tests fail (proving bug exists) but CI reports them as passed. ### Verification Results | Nox Session | Result | |---|---| | `lint` | PASS | | `typecheck` | PASS (0 errors) | | `unit_tests` | PASS (380 features, 10809 scenarios) | | `coverage_report` | 98% (>= 97% threshold) | ### Files Created | File | Lines | Purpose | |---|---|---| | `features/tdd_subplan_spawn_orchestration.feature` | 34 | 3 Behave scenarios | | `features/steps/tdd_subplan_spawn_orchestration_steps.py` | 246 | Step definitions with full type annotations | | `robot/tdd_subplan_spawn_orchestration.robot` | 44 | 3 Robot test cases | | `robot/helper_tdd_subplan_spawn_orchestration.py` | 250 | Python helper with 3 subcommands | ### Commit `a0bd2ca63fd5bb415712ab763889f37c2c143774` on branch `tdd/m6-subplan-spawn-orchestration`
Member

Post-Crash Recovery Notes

Context

The system crashed while reviewing/updating PR #930. The branch had been pushed with a merge commit (fdcb5ff5 Merge branch 'master' into tdd/m6-subplan-spawn-orchestration) which violates the project's no-merge-commit rule. Additionally, the PR had an empty description and was missing dependency links.

Recovery Actions

1. Branch rebase (merge commit removal)

  • Cherry-picked the original feature commit a0bd2ca6 onto a fresh checkout of origin/master
  • Eliminated the merge commit entirely — branch now has exactly one clean commit

2. No code changes needed
Unlike the checkpoint branch, the subplan branch code was clean and required no modifications. All nox sessions passed on the first attempt.

3. PR metadata updated

  • Added comprehensive PR description to PR #930
  • Added dependency link: issue #838 depends on PR #930
  • Type/Testing label and v3.5.0 milestone were already correctly set

Final Commit

851f1bd18c3ac6306eabe496dbc5af284fb68141 on branch tdd/m6-subplan-spawn-orchestration

CI Results

Check Result
lint PASS
typecheck PASS
unit_tests PASS (2m16s)
integration_tests PASS (2m37s)
coverage pending (in progress)
security PASS
quality PASS
benchmark-regression pending (in progress)
build PASS
docker PASS
e2e_tests PASS

Coverage and benchmark checks are still running but all other checks have passed.

## Post-Crash Recovery Notes ### Context The system crashed while reviewing/updating PR #930. The branch had been pushed with a merge commit (`fdcb5ff5 Merge branch 'master' into tdd/m6-subplan-spawn-orchestration`) which violates the project's no-merge-commit rule. Additionally, the PR had an empty description and was missing dependency links. ### Recovery Actions **1. Branch rebase (merge commit removal)** - Cherry-picked the original feature commit `a0bd2ca6` onto a fresh checkout of `origin/master` - Eliminated the merge commit entirely — branch now has exactly one clean commit **2. No code changes needed** Unlike the checkpoint branch, the subplan branch code was clean and required no modifications. All nox sessions passed on the first attempt. **3. PR metadata updated** - Added comprehensive PR description to PR #930 - Added dependency link: issue #838 depends on PR #930 - `Type/Testing` label and `v3.5.0` milestone were already correctly set ### Final Commit `851f1bd18c3ac6306eabe496dbc5af284fb68141` on branch `tdd/m6-subplan-spawn-orchestration` ### CI Results | Check | Result | |---|---| | lint | PASS | | typecheck | PASS | | unit_tests | PASS (2m16s) | | integration_tests | PASS (2m37s) | | coverage | pending (in progress) | | security | PASS | | quality | PASS | | benchmark-regression | pending (in progress) | | build | PASS | | docker | PASS | | e2e_tests | PASS | Coverage and benchmark checks are still running but all other checks have passed.
Author
Owner

Dependency (TDD workflow): This TDD test issue blocks bug fix #823. This issue must be completed and merged first so the @tdd_expected_fail test exists before the fix is implemented.

Blocks: #823

**Dependency (TDD workflow):** This TDD test issue blocks bug fix #823. This issue must be completed and merged first so the `@tdd_expected_fail` test exists before the fix is implemented. **Blocks:** #823
Author
Owner

PM Acknowledgment — Day 34

Good implementation notes, Brent. The 3-scenario structure (spawn returns Plans, child enters strategize, parent tracks status) maps directly to the bug description in #823. The post-crash recovery was handled correctly — merge commit removed via cherry-pick, PR metadata restored. CI looks clean.

PR #930 is now in review. @CoreRasurae has been assigned as peer reviewer. This is on the critical path — once #930 merges, the bug fix for #823 can proceed.

**PM Acknowledgment — Day 34** Good implementation notes, Brent. The 3-scenario structure (spawn returns Plans, child enters strategize, parent tracks status) maps directly to the bug description in #823. The post-crash recovery was handled correctly — merge commit removed via cherry-pick, PR metadata restored. CI looks clean. PR #930 is now in review. @CoreRasurae has been assigned as peer reviewer. This is on the critical path — once #930 merges, the bug fix for #823 can proceed.
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#838
No description provided.