UAT: SubplanService.spawn() does not inherit automation_profile from parent plan — child plans execute without automation behavior context #3956

Open
opened 2026-04-06 07:50:26 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/subplan-automation-profile-inheritance
  • Commit Message: fix(subplan): inherit automation_profile from parent plan in SubplanService.spawn()
  • Milestone: Backlog (no milestone assigned)
  • Parent Epic: #368

Backlog note: This issue was discovered during autonomous operation
on milestone v3.4.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

SubplanService.spawn() creates child Plan domain objects but does not copy the automation_profile field from the parent plan. The automation_profile field controls how the child plan executes — whether decisions are made automatically or require user intervention.

Per docs/specification.md: "Automation behavior is controlled exclusively by AutomationProfileRef, resolved at plan use time using plan > action > project > global precedence." Child plans spawned via SubplanService.spawn() should inherit the parent plan's resolved automation_profile so they execute with the same automation behavior as the parent.

  • Discovered by: UAT tester (ca-uat-tester), feature area: Subplan and Parallel Execution
  • File: src/cleveragents/application/services/subplan_service.py
  • Method: SubplanService.spawn()

Current Behavior

The child plan is created without automation_profile:

child_plan = Plan(
    identity=PlanIdentity(...),
    namespaced_name=...,
    description=...,
    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,
    # automation_profile NOT set — child plan has None
)

This means child plans will have automation_profile=None, causing them to fall back to the global default automation profile rather than using the parent's resolved profile.

Steps to Reproduce (Code-Level)

  1. Create a parent plan with a non-default automation_profile (e.g., trusted profile)
  2. Call SubplanService.spawn() with spawn entries
  3. Inspect the returned child_plans — each child plan's automation_profile will be None

Impact

Child plans spawned from a parent with a specific automation profile (e.g., fully automatic) will not inherit that profile. This could cause child plans to prompt for user input when the parent was configured for autonomous operation, or vice versa.

Expected Behavior

SubplanService.spawn() should set automation_profile on child plans from the parent plan's resolved profile, ensuring child plans execute with the same automation behavior as the parent.

Subtasks

  • Inherit automation_profile from parent plan in SubplanService.spawn()
  • Add unit test (behave) verifying child plans inherit parent's automation profile
  • Verify child plan automation profile provenance is set correctly

Definition of Done

  • SubplanService.spawn() sets automation_profile on child plans from the parent plan's resolved profile
  • Unit tests cover the inheritance behavior
  • No regression in existing subplan spawn tests
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/subplan-automation-profile-inheritance` - **Commit Message**: `fix(subplan): inherit automation_profile from parent plan in SubplanService.spawn()` - **Milestone**: Backlog (no milestone assigned) - **Parent Epic**: #368 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.4.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context `SubplanService.spawn()` creates child `Plan` domain objects but does **not** copy the `automation_profile` field from the parent plan. The `automation_profile` field controls how the child plan executes — whether decisions are made automatically or require user intervention. Per `docs/specification.md`: "Automation behavior is controlled exclusively by `AutomationProfileRef`, resolved at `plan use` time using plan > action > project > global precedence." Child plans spawned via `SubplanService.spawn()` should inherit the parent plan's resolved `automation_profile` so they execute with the same automation behavior as the parent. - **Discovered by**: UAT tester (ca-uat-tester), feature area: Subplan and Parallel Execution - **File**: `src/cleveragents/application/services/subplan_service.py` - **Method**: `SubplanService.spawn()` ## Current Behavior The child plan is created without `automation_profile`: ```python child_plan = Plan( identity=PlanIdentity(...), namespaced_name=..., description=..., 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, # automation_profile NOT set — child plan has None ) ``` This means child plans will have `automation_profile=None`, causing them to fall back to the global default automation profile rather than using the parent's resolved profile. ### Steps to Reproduce (Code-Level) 1. Create a parent plan with a non-default `automation_profile` (e.g., `trusted` profile) 2. Call `SubplanService.spawn()` with spawn entries 3. Inspect the returned `child_plans` — each child plan's `automation_profile` will be `None` ### Impact Child plans spawned from a parent with a specific automation profile (e.g., fully automatic) will not inherit that profile. This could cause child plans to prompt for user input when the parent was configured for autonomous operation, or vice versa. ## Expected Behavior `SubplanService.spawn()` should set `automation_profile` on child plans from the parent plan's resolved profile, ensuring child plans execute with the same automation behavior as the parent. ## Subtasks - [ ] Inherit `automation_profile` from parent plan in `SubplanService.spawn()` - [ ] Add unit test (behave) verifying child plans inherit parent's automation profile - [ ] Verify child plan automation profile provenance is set correctly ## Definition of Done - [ ] `SubplanService.spawn()` sets `automation_profile` on child plans from the parent plan's resolved profile - [ ] Unit tests cover the inheritance behavior - [ ] No regression in existing subplan spawn tests - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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#3956
No description provided.