UAT: PlanLifecycleService.create_action() missing apply_actor parameter — apply actor silently dropped on action creation #2499

Open
opened 2026-04-03 18:39:38 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: fix/plan-lifecycle-create-action-apply-actor
  • Commit Message: fix(plan-lifecycle): add apply_actor parameter to create_action() to prevent silent data loss
  • Milestone: v3.6.0
  • Parent Epic: #372

Summary

PlanLifecycleService.create_action() in src/cleveragents/application/services/plan_lifecycle_service.py (lines 507–596) does not accept an apply_actor parameter. The Action domain model (src/cleveragents/domain/models/core/action.py, line 385) defines apply_actor: str | None as an optional field for the Apply phase actor, and Action.from_config() (line 646) correctly parses it from YAML. However, because create_action() never receives this value, any apply_actor specified in an action YAML config is silently dropped at persistence time.

The use_action() method works around this with getattr(action, "apply_actor", None) (line 859), but only because it operates on the in-memory Action object directly. Once the action is reloaded from the database — where apply_actor was never stored — the field will be None.

Expected Behavior (per spec)

The apply_actor field is an optional actor for the Apply phase, defined in the Action data model. It must be accepted by create_action() and persisted when an action is created.

Actual Behavior

apply_actor is silently dropped when create_action() is called, because the method signature does not include this parameter. Any action YAML that specifies apply_actor will appear to succeed, but the value will not be stored.

Steps to Reproduce

  1. Create an action YAML with apply_actor: local/my-apply-actor
  2. Run agents action create --config action.yaml
  3. Run agents action show local/my-action
  4. Observe that apply_actor is absent — it was silently dropped at creation time

Code Locations

  • src/cleveragents/application/services/plan_lifecycle_service.py, lines 507–596 — create_action() is missing the apply_actor: str | None = None parameter and does not pass it when constructing the Action object
  • src/cleveragents/cli/commands/action.py, lines 242–253 — CLI action create command does not extract or forward apply_actor to the service

Proposed Fix

  1. Add apply_actor: str | None = None to the PlanLifecycleService.create_action() signature
  2. Pass apply_actor when constructing the Action object inside create_action()
  3. Update the CLI action create command to read apply_actor from the parsed config and pass it to the service

Subtasks

  • Add apply_actor: str | None = None parameter to PlanLifecycleService.create_action() (lines 507–596)
  • Pass apply_actor when constructing the Action object inside create_action()
  • Update src/cleveragents/cli/commands/action.py (lines 242–253) to extract apply_actor from the parsed config and forward it to create_action()
  • Verify use_action() (line 859) still works correctly after the fix (the getattr workaround may be removed or retained as a defensive fallback)
  • Add Behave unit test: create an action with apply_actor set, reload from DB, assert apply_actor is preserved
  • Add Behave unit test: create an action without apply_actor, assert field is None (no regression)
  • Run nox -e typecheck — no # type: ignore suppressions permitted
  • Run nox (all default sessions), fix any errors

Definition of Done

  • PlanLifecycleService.create_action() accepts and persists apply_actor
  • CLI agents action create correctly forwards apply_actor from YAML config to the service
  • An action created with apply_actor: local/my-apply-actor shows the correct value when reloaded from the database
  • All Behave unit tests for the fix pass
  • nox -e typecheck passes with zero errors and no suppression comments
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/plan-lifecycle-create-action-apply-actor` - **Commit Message**: `fix(plan-lifecycle): add apply_actor parameter to create_action() to prevent silent data loss` - **Milestone**: v3.6.0 - **Parent Epic**: #372 ## Summary `PlanLifecycleService.create_action()` in `src/cleveragents/application/services/plan_lifecycle_service.py` (lines 507–596) does not accept an `apply_actor` parameter. The `Action` domain model (`src/cleveragents/domain/models/core/action.py`, line 385) defines `apply_actor: str | None` as an optional field for the Apply phase actor, and `Action.from_config()` (line 646) correctly parses it from YAML. However, because `create_action()` never receives this value, any `apply_actor` specified in an action YAML config is silently dropped at persistence time. The `use_action()` method works around this with `getattr(action, "apply_actor", None)` (line 859), but only because it operates on the in-memory `Action` object directly. Once the action is reloaded from the database — where `apply_actor` was never stored — the field will be `None`. ## Expected Behavior (per spec) The `apply_actor` field is an optional actor for the Apply phase, defined in the Action data model. It must be accepted by `create_action()` and persisted when an action is created. ## Actual Behavior `apply_actor` is silently dropped when `create_action()` is called, because the method signature does not include this parameter. Any action YAML that specifies `apply_actor` will appear to succeed, but the value will not be stored. ## Steps to Reproduce 1. Create an action YAML with `apply_actor: local/my-apply-actor` 2. Run `agents action create --config action.yaml` 3. Run `agents action show local/my-action` 4. Observe that `apply_actor` is absent — it was silently dropped at creation time ## Code Locations - `src/cleveragents/application/services/plan_lifecycle_service.py`, lines 507–596 — `create_action()` is missing the `apply_actor: str | None = None` parameter and does not pass it when constructing the `Action` object - `src/cleveragents/cli/commands/action.py`, lines 242–253 — CLI `action create` command does not extract or forward `apply_actor` to the service ## Proposed Fix 1. Add `apply_actor: str | None = None` to the `PlanLifecycleService.create_action()` signature 2. Pass `apply_actor` when constructing the `Action` object inside `create_action()` 3. Update the CLI `action create` command to read `apply_actor` from the parsed config and pass it to the service ## Subtasks - [ ] Add `apply_actor: str | None = None` parameter to `PlanLifecycleService.create_action()` (lines 507–596) - [ ] Pass `apply_actor` when constructing the `Action` object inside `create_action()` - [ ] Update `src/cleveragents/cli/commands/action.py` (lines 242–253) to extract `apply_actor` from the parsed config and forward it to `create_action()` - [ ] Verify `use_action()` (line 859) still works correctly after the fix (the `getattr` workaround may be removed or retained as a defensive fallback) - [ ] Add Behave unit test: create an action with `apply_actor` set, reload from DB, assert `apply_actor` is preserved - [ ] Add Behave unit test: create an action without `apply_actor`, assert field is `None` (no regression) - [ ] Run `nox -e typecheck` — no `# type: ignore` suppressions permitted - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] `PlanLifecycleService.create_action()` accepts and persists `apply_actor` - [ ] CLI `agents action create` correctly forwards `apply_actor` from YAML config to the service - [ ] An action created with `apply_actor: local/my-apply-actor` shows the correct value when reloaded from the database - [ ] All Behave unit tests for the fix pass - [ ] `nox -e typecheck` passes with zero errors and no suppression comments - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.6.0 milestone 2026-04-03 18:39:45 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement that should be included in the milestone.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement that should be included in the milestone. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Confirmed
  • MoSCoW: Should Have (already set)

Valid finding verified during batch triage.


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Confirmed - **MoSCoW**: Should Have (already set) Valid finding verified during batch triage. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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
Reference
cleveragents/cleveragents-core#2499
No description provided.