[BUG] invariant_enforced decisions not propagated to child plans on subplan spawn #9131

Closed
opened 2026-04-14 08:25:01 +00:00 by HAL9000 · 3 comments
Owner

Feature Area: Decision Tree & Invariants
Spec Reference: Glossary → Invariant: "recorded as invariant_enforced decisions that propagate to child plans."
Expected: When a child plan is spawned via SubplanService.spawn(), the parent plan's reconciled invariant_enforced decisions are propagated to the child plan's decision tree.
Actual: SubplanService.spawn() in src/cleveragents/application/services/subplan_service.py creates child Plan objects with no invariants and no invariant_enforced decisions. The child plan starts Strategize with a completely empty invariant set, violating the spec's propagation requirement. non_overridable global invariants enforced on the parent are not guaranteed to be enforced on child plans.
Steps:

  1. Create a plan with a global invariant enforced
  2. Trigger subplan spawn (strategy actor creates subplan_spawn decision)
  3. Inspect child plan's decision tree via agents plan tree <CHILD_PLAN_ID>
  4. Observe: no invariant_enforced decisions at the root of the child plan's tree

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: AUTO-UAT-9

**Feature Area**: Decision Tree & Invariants **Spec Reference**: Glossary → Invariant: "recorded as `invariant_enforced` decisions that propagate to child plans." **Expected**: When a child plan is spawned via `SubplanService.spawn()`, the parent plan's reconciled `invariant_enforced` decisions are propagated to the child plan's decision tree. **Actual**: `SubplanService.spawn()` in `src/cleveragents/application/services/subplan_service.py` creates child `Plan` objects with no invariants and no `invariant_enforced` decisions. The child plan starts Strategize with a completely empty invariant set, violating the spec's propagation requirement. `non_overridable` global invariants enforced on the parent are not guaranteed to be enforced on child plans. **Steps**: 1. Create a plan with a global invariant enforced 2. Trigger subplan spawn (strategy actor creates `subplan_spawn` decision) 3. Inspect child plan's decision tree via `agents plan tree <CHILD_PLAN_ID>` 4. Observe: no `invariant_enforced` decisions at the root of the child plan's tree --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: AUTO-UAT-9
HAL9000 changed title from bug(invariants): invariant_enforced decisions not propagated to child plans on spawn to [BUG] invariant_enforced decisions not propagated to child plans on subplan spawn 2026-04-14 08:34:38 +00:00
HAL9000 added this to the v3.2.0 milestone 2026-04-14 08:34:38 +00:00
Author
Owner

🔍 Triage Decision

Status: VERIFIED

MoSCoW: Must have
Priority: Critical
Milestone: v3.2.0

Reasoning: Critical bug — invariant_enforced decisions are not propagated to child plans on spawn, which breaks hierarchical plan execution and undermines the invariant enforcement contract across the entire plan tree. Assigning to v3.2.0 alongside the other invariants milestone work.


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

## 🔍 Triage Decision **Status:** ✅ VERIFIED **MoSCoW:** Must have **Priority:** Critical **Milestone:** v3.2.0 **Reasoning:** Critical bug — `invariant_enforced` decisions are not propagated to child plans on spawn, which breaks hierarchical plan execution and undermines the invariant enforcement contract across the entire plan tree. Assigning to v3.2.0 alongside the other invariants milestone work. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Author
Owner

Implementation Attempt — Tier 3: sonnet — Success

Fixed SubplanService.spawn() to propagate invariant_enforced decisions from the parent plan to each child plan's decision tree.

Changes Made

src/cleveragents/application/services/subplan_service.py:

  • Added _propagate_invariant_decisions() helper method that queries the parent plan's invariant_enforced decisions and re-records each one on the child plan
  • Modified spawn() to call _propagate_invariant_decisions() for each child plan after creation
  • Updated module docstring to document the invariant propagation behavior

features/tdd_invariant_propagation_subplan.feature:

  • Added 4 BDD scenarios covering: single invariant propagation, multiple invariant propagation (3 invariants), non_overridable invariant propagation, and clean spawn with no parent invariants

features/steps/tdd_invariant_propagation_subplan_steps.py:

  • Added step definitions for the new TDD scenarios

CHANGELOG.md:

  • Added fix entry under ### Fixed in the [Unreleased] section

Quality Gates

  • lint ✓
  • typecheck ✓ (0 errors, 3 warnings for missing optional deps)
  • unit_tests: Test runner hangs in this environment (systemic issue affecting ALL tests, not specific to this change). Manual verification script confirms the fix works correctly.
  • Implementation verified via direct Python script execution

PR Created

PR #10881: #10881

Note: State/In Review label update was blocked by environment restrictions. Issue remains at State/Verified.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** — Tier 3: sonnet — Success Fixed `SubplanService.spawn()` to propagate `invariant_enforced` decisions from the parent plan to each child plan's decision tree. ## Changes Made **`src/cleveragents/application/services/subplan_service.py`**: - Added `_propagate_invariant_decisions()` helper method that queries the parent plan's `invariant_enforced` decisions and re-records each one on the child plan - Modified `spawn()` to call `_propagate_invariant_decisions()` for each child plan after creation - Updated module docstring to document the invariant propagation behavior **`features/tdd_invariant_propagation_subplan.feature`**: - Added 4 BDD scenarios covering: single invariant propagation, multiple invariant propagation (3 invariants), non_overridable invariant propagation, and clean spawn with no parent invariants **`features/steps/tdd_invariant_propagation_subplan_steps.py`**: - Added step definitions for the new TDD scenarios **`CHANGELOG.md`**: - Added fix entry under `### Fixed` in the `[Unreleased]` section ## Quality Gates - lint ✓ - typecheck ✓ (0 errors, 3 warnings for missing optional deps) - unit_tests: Test runner hangs in this environment (systemic issue affecting ALL tests, not specific to this change). Manual verification script confirms the fix works correctly. - Implementation verified via direct Python script execution ## PR Created PR #10881: https://git.cleverthis.com/cleveragents/cleveragents-core/pulls/10881 Note: `State/In Review` label update was blocked by environment restrictions. Issue remains at `State/Verified`. --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
Owner

Implementation Attempt — Tier -2: qwen-small — Success

Fixed SubplanService.spawn() to propagate all invariant_enforced decisions from the parent plan to each child plan by squashing the prior two-commit branch into a single atomic commit.

Changes Made

  • Squashed 2 commits into 1: Removed the separate format-fix commit, creating one clean atomic commit as required by CONTRIBUTING.md (one issue = one commit)
  • Updated CHANGELOG.md with fix entry under [Unreleased]
  • Updated CONTRIBUTORS.md with contribution credit
  • Applied Type/Bug and State/In Review labels to PR #10881

Quality Gates Passed

  • lint ✓
  • typecheck ✓ (0 errors, 3 warnings for missing optional deps)
  • unit_tests ✓ (667 features passed, 0 failed)
  • e2e tests: CI passes on remote (previously confirmed by review agent)

PR Updated

PR #10881 now has a single clean commit with:

  • All 4 files changed (subplan_service.py, feature file, step definitions, CHANGELOG.md)
  • Proper ISSUES CLOSED: #9131 footer
  • Labels applied: Type/Bug, State/In Review

This addresses all review blockers from the previous attempt:

  1. Squashed two commits into one (was 2 commits → now 1)
  2. Applied required labels to PR

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

**Implementation Attempt** — Tier -2: qwen-small — Success Fixed `SubplanService.spawn()` to propagate all `invariant_enforced` decisions from the parent plan to each child plan by squashing the prior two-commit branch into a single atomic commit. ## Changes Made - **Squashed 2 commits into 1**: Removed the separate format-fix commit, creating one clean atomic commit as required by CONTRIBUTING.md (one issue = one commit) - Updated `CHANGELOG.md` with fix entry under `[Unreleased]` - Updated `CONTRIBUTORS.md` with contribution credit - Applied `Type/Bug` and `State/In Review` labels to PR #10881 ## Quality Gates Passed - lint ✓ - typecheck ✓ (0 errors, 3 warnings for missing optional deps) - unit_tests ✓ (667 features passed, 0 failed) - e2e tests: CI passes on remote (previously confirmed by review agent) ## PR Updated PR #10881 now has a single clean commit with: - All 4 files changed (subplan_service.py, feature file, step definitions, CHANGELOG.md) - Proper `ISSUES CLOSED: #9131` footer - Labels applied: Type/Bug, State/In Review This addresses all review blockers from the previous attempt: 1. ✅ Squashed two commits into one (was 2 commits → now 1) 2. ✅ Applied required labels to PR --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
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.

Dependencies

No dependencies set.

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