UAT: SubplanService.spawn() does not inherit automation profile from parent plan to child plans #2061

Open
opened 2026-04-03 03:46:20 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/subplan-service-spawn-automation-profile-inheritance
  • Commit Message: fix(service): copy automation_profile and effective_profile_snapshot in SubplanService.spawn()
  • Milestone: v3.7.0
  • Parent Epic: #368

Description

The SubplanService.spawn() method in src/cleveragents/application/services/subplan_service.py creates child Plan domain objects without copying the parent plan's automation_profile or effective_profile_snapshot. This violates the specification's requirement for child plan profile inheritance.

Expected Behavior (from spec)

The spec (docs/specification.md §Child Plan Profile Inheritance, line 28467) states:

"Child plans inherit the parent plan's effective automation profile. If the parent's profile is changed explicitly after creation, new child plans use the new profile while already-running child plans retain their original profile."

Actual Behavior

The spawn() method (lines 259–284) creates child plans with:

child_plan: Plan = Plan(
    identity=PlanIdentity(...),
    namespaced_name=NamespacedName(...),
    description=entry.description or f"Child plan for {entry.action_name}",
    definition_of_done=parent_plan.definition_of_done,
    action_name=entry.action_name,
    phase=PlanPhase.STRATEGIZE,
    processing_state=ProcessingState.QUEUED,
    strategy_actor=parent_plan.strategy_actor,
    execution_actor=parent_plan.execution_actor,
    project_links=list(parent_plan.project_links),
    timestamps=PlanTimestamps(),
    created_by=parent_plan.created_by,
    reusable=parent_plan.reusable,
    read_only=parent_plan.read_only,
)

Notice that automation_profile and effective_profile_snapshot are not copied from the parent. Child plans are created with automation_profile=None (the default), meaning they have no automation profile and will not enforce the parent's autonomy constraints.

Code Location

src/cleveragents/application/services/subplan_service.py, lines 259–284

Impact

Child plans spawned from a parent with a restrictive automation profile (e.g., require_sandbox=True, edit_code=0.7) will run without any automation constraints, potentially performing unsafe operations that the parent's profile was designed to prevent.

Fix Direction

Add automation_profile=parent_plan.automation_profile and effective_profile_snapshot=parent_plan.effective_profile_snapshot to the child Plan constructor call in spawn().

Subtasks

  • Write a failing Behave scenario (TDD) that reproduces the missing profile inheritance in SubplanService.spawn() and merge it to master before the fix
  • Add automation_profile=parent_plan.automation_profile to the child Plan constructor in spawn() (lines 259–284)
  • Add effective_profile_snapshot=parent_plan.effective_profile_snapshot to the child Plan constructor in spawn()
  • Verify that child plans spawned from a parent with a restrictive profile correctly inherit and enforce that profile's constraints
  • Verify that already-running child plans are unaffected when the parent's profile is changed after spawn (per spec §Child Plan Profile Inheritance)
  • Update or add Robot Framework integration tests covering the profile inheritance scenario end-to-end
  • Run nox (all sessions) and confirm all quality gates pass

Definition of Done

  • A failing Behave test reproducing the bug has been merged to master prior to the fix PR
  • automation_profile and effective_profile_snapshot are copied from parent to child in SubplanService.spawn()
  • All existing Behave unit tests continue to pass
  • New Behave scenario(s) covering profile inheritance pass
  • Robot Framework integration tests pass with no regressions
  • All nox stages pass (lint, typecheck, unit_tests, integration_tests, coverage_report)
  • Coverage >= 97%
  • The associated PR has been reviewed by at least two non-author contributors and merged

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `fix/subplan-service-spawn-automation-profile-inheritance` - **Commit Message**: `fix(service): copy automation_profile and effective_profile_snapshot in SubplanService.spawn()` - **Milestone**: v3.7.0 - **Parent Epic**: #368 ## Description The `SubplanService.spawn()` method in `src/cleveragents/application/services/subplan_service.py` creates child `Plan` domain objects without copying the parent plan's `automation_profile` or `effective_profile_snapshot`. This violates the specification's requirement for child plan profile inheritance. ### Expected Behavior (from spec) The spec (`docs/specification.md` §Child Plan Profile Inheritance, line 28467) states: > "Child plans inherit the parent plan's effective automation profile. If the parent's profile is changed explicitly after creation, new child plans use the new profile while already-running child plans retain their original profile." ### Actual Behavior The `spawn()` method (lines 259–284) creates child plans with: ```python child_plan: Plan = Plan( identity=PlanIdentity(...), namespaced_name=NamespacedName(...), description=entry.description or f"Child plan for {entry.action_name}", definition_of_done=parent_plan.definition_of_done, action_name=entry.action_name, phase=PlanPhase.STRATEGIZE, processing_state=ProcessingState.QUEUED, strategy_actor=parent_plan.strategy_actor, execution_actor=parent_plan.execution_actor, project_links=list(parent_plan.project_links), timestamps=PlanTimestamps(), created_by=parent_plan.created_by, reusable=parent_plan.reusable, read_only=parent_plan.read_only, ) ``` Notice that `automation_profile` and `effective_profile_snapshot` are **not** copied from the parent. Child plans are created with `automation_profile=None` (the default), meaning they have no automation profile and will not enforce the parent's autonomy constraints. ### Code Location `src/cleveragents/application/services/subplan_service.py`, lines 259–284 ### Impact Child plans spawned from a parent with a restrictive automation profile (e.g., `require_sandbox=True`, `edit_code=0.7`) will run without any automation constraints, potentially performing unsafe operations that the parent's profile was designed to prevent. ### Fix Direction Add `automation_profile=parent_plan.automation_profile` and `effective_profile_snapshot=parent_plan.effective_profile_snapshot` to the child `Plan` constructor call in `spawn()`. ## Subtasks - [ ] Write a failing Behave scenario (TDD) that reproduces the missing profile inheritance in `SubplanService.spawn()` and merge it to `master` before the fix - [ ] Add `automation_profile=parent_plan.automation_profile` to the child `Plan` constructor in `spawn()` (lines 259–284) - [ ] Add `effective_profile_snapshot=parent_plan.effective_profile_snapshot` to the child `Plan` constructor in `spawn()` - [ ] Verify that child plans spawned from a parent with a restrictive profile correctly inherit and enforce that profile's constraints - [ ] Verify that already-running child plans are unaffected when the parent's profile is changed after spawn (per spec §Child Plan Profile Inheritance) - [ ] Update or add Robot Framework integration tests covering the profile inheritance scenario end-to-end - [ ] Run `nox` (all sessions) and confirm all quality gates pass ## Definition of Done - [ ] A failing Behave test reproducing the bug has been merged to `master` prior to the fix PR - [ ] `automation_profile` and `effective_profile_snapshot` are copied from parent to child in `SubplanService.spawn()` - [ ] All existing Behave unit tests continue to pass - [ ] New Behave scenario(s) covering profile inheritance pass - [ ] Robot Framework integration tests pass with no regressions - [ ] All nox stages pass (`lint`, `typecheck`, `unit_tests`, `integration_tests`, `coverage_report`) - [ ] Coverage >= 97% - [ ] The associated PR has been reviewed by at least two non-author contributors and merged --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.7.0 milestone 2026-04-03 03:46:24 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — Elevated to Critical consideration. Child plans running without the parent's automation profile constraints is a safety issue. A parent plan with require_sandbox=True or restrictive edit_code thresholds would have those constraints silently dropped on child plans, potentially allowing unsafe operations. This is a spec violation with security implications.
  • Milestone: v3.7.0 (already assigned — though this could arguably be v3.5.0 since it affects the autonomy hardening guarantees)
  • MoSCoW: Must Have — The spec explicitly requires child plan profile inheritance (§Child Plan Profile Inheritance, line 28467). Without this, the entire automation profile system is undermined for hierarchical plan execution, which is a core v3.5.0 acceptance criterion ("Full autonomy acceptance flow with hierarchical decomposition").
  • Parent Epic: #368 (confirmed correct)

This is the highest-priority new issue found in this cycle. The fix is straightforward (add two fields to the constructor call) but the impact of the bug is significant for safety guarantees.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — **Elevated to Critical consideration.** Child plans running without the parent's automation profile constraints is a safety issue. A parent plan with `require_sandbox=True` or restrictive `edit_code` thresholds would have those constraints silently dropped on child plans, potentially allowing unsafe operations. This is a spec violation with security implications. - **Milestone**: v3.7.0 (already assigned — though this could arguably be v3.5.0 since it affects the autonomy hardening guarantees) - **MoSCoW**: Must Have — The spec explicitly requires child plan profile inheritance (§Child Plan Profile Inheritance, line 28467). Without this, the entire automation profile system is undermined for hierarchical plan execution, which is a core v3.5.0 acceptance criterion ("Full autonomy acceptance flow with hierarchical decomposition"). - **Parent Epic**: #368 (confirmed correct) **This is the highest-priority new issue found in this cycle.** The fix is straightforward (add two fields to the constructor call) but the impact of the bug is significant for safety guarantees. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo self-assigned this 2026-04-03 16:58:12 +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.

Blocks
#368 Epic: Subplans & Parallelism
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#2061
No description provided.