UAT: PlanLifecycleService.create_action() missing argument validation for required fields — empty description, strategy_actor, execution_actor accepted without error #5790

Open
opened 2026-04-09 09:37:51 +00:00 by HAL9000 · 1 comment
Owner

Summary

src/cleveragents/application/services/plan_lifecycle_service.py create_action() method only validates the name argument format but does not validate other required fields (description, definition_of_done, strategy_actor, execution_actor). Per CONTRIBUTING.md, all public methods must validate arguments as the first step.

Code Location

# plan_lifecycle_service.py lines 718-793
def create_action(
    self,
    name: str,
    description: str,        # <-- Required but not validated
    definition_of_done: str, # <-- Required but not validated
    strategy_actor: str,     # <-- Required but not validated
    execution_actor: str,    # <-- Required but not validated
    ...
) -> Action:
    self._logger.info("Creating action", name=name)

    # Parse namespaced name (only validation performed)
    try:
        namespaced_name = NamespacedName.parse(name)
    except ValueError as e:
        raise ValidationError(f"Invalid action name: {e}") from e

    # No validation of description, definition_of_done, strategy_actor, execution_actor!
    action = Action(
        namespaced_name=namespaced_name,
        description=description,  # Could be empty string ""
        ...
    )

Expected Behavior (per CONTRIBUTING.md)

Per CONTRIBUTING.md:

All public and protected class methods must validate arguments as the first guard. Perform these checks before any other logic.

  • Empty Strings: Reject empty strings where non-empty strings are required.

The following fields are required and should be validated:

  • description: Must be non-empty (required for CLI display and LLM context)
  • definition_of_done: Must be non-empty (required for plan completion criteria)
  • strategy_actor: Must be non-empty (required for Strategize phase)
  • execution_actor: Must be non-empty (required for Execute phase)

Actual Behavior

Empty strings are accepted for required fields. This results in:

  • Actions with empty descriptions that display as blank in agents action list
  • Plans that fail during execution because strategy_actor or execution_actor is empty
  • Confusing downstream errors instead of clear validation errors at creation time

Fix Required

Add argument validation at the start of create_action():

def create_action(self, name: str, description: str, ...) -> Action:
    # Validate required arguments first (fail-fast)
    if not description or not description.strip():
        raise ValidationError("description must not be empty")
    if not definition_of_done or not definition_of_done.strip():
        raise ValidationError("definition_of_done must not be empty")
    if not strategy_actor or not strategy_actor.strip():
        raise ValidationError("strategy_actor must not be empty")
    if not execution_actor or not execution_actor.strip():
        raise ValidationError("execution_actor must not be empty")
    # ... rest of method

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

## Summary `src/cleveragents/application/services/plan_lifecycle_service.py` `create_action()` method only validates the `name` argument format but does not validate other required fields (`description`, `definition_of_done`, `strategy_actor`, `execution_actor`). Per CONTRIBUTING.md, all public methods must validate arguments as the first step. ## Code Location ```python # plan_lifecycle_service.py lines 718-793 def create_action( self, name: str, description: str, # <-- Required but not validated definition_of_done: str, # <-- Required but not validated strategy_actor: str, # <-- Required but not validated execution_actor: str, # <-- Required but not validated ... ) -> Action: self._logger.info("Creating action", name=name) # Parse namespaced name (only validation performed) try: namespaced_name = NamespacedName.parse(name) except ValueError as e: raise ValidationError(f"Invalid action name: {e}") from e # No validation of description, definition_of_done, strategy_actor, execution_actor! action = Action( namespaced_name=namespaced_name, description=description, # Could be empty string "" ... ) ``` ## Expected Behavior (per CONTRIBUTING.md) Per CONTRIBUTING.md: > **All public and protected class methods must validate arguments as the first guard.** Perform these checks before any other logic. > - **Empty Strings:** Reject empty strings where non-empty strings are required. The following fields are required and should be validated: - `description`: Must be non-empty (required for CLI display and LLM context) - `definition_of_done`: Must be non-empty (required for plan completion criteria) - `strategy_actor`: Must be non-empty (required for Strategize phase) - `execution_actor`: Must be non-empty (required for Execute phase) ## Actual Behavior Empty strings are accepted for required fields. This results in: - Actions with empty descriptions that display as blank in `agents action list` - Plans that fail during execution because `strategy_actor` or `execution_actor` is empty - Confusing downstream errors instead of clear validation errors at creation time ## Fix Required Add argument validation at the start of `create_action()`: ```python def create_action(self, name: str, description: str, ...) -> Action: # Validate required arguments first (fail-fast) if not description or not description.strip(): raise ValidationError("description must not be empty") if not definition_of_done or not definition_of_done.strip(): raise ValidationError("definition_of_done must not be empty") if not strategy_actor or not strategy_actor.strip(): raise ValidationError("strategy_actor must not be empty") if not execution_actor or not execution_actor.strip(): raise ValidationError("execution_actor must not be empty") # ... rest of method ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Label compliance fix applied:

  • Added missing label: State/Unverified
  • Reason: Issue was missing required State/* label per CONTRIBUTING.md. All new issues must have a state label. Defaulting to State/Unverified as the safest initial state.

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing label: `State/Unverified` - Reason: Issue was missing required State/* label per CONTRIBUTING.md. All new issues must have a state label. Defaulting to `State/Unverified` as the safest initial state. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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.

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