UAT: agents plan tree does not validate ULID format before querying decisions #3195

Open
opened 2026-04-05 07:37:16 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: bugfix/plan-tree-ulid-validation
  • Commit Message: fix(cli): add ULID validation to plan tree command
  • Milestone: None (backlog — see note below)
  • Parent Epic: #357

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

Bug Report

Feature Area: plan tree and plan explain CLI Commands (v3.2.0)

What was tested

Code analysis of src/cleveragents/cli/commands/plan.py:

  • Lines 3646–3673: tree_decisions_cmd command

Spec Reference

docs/specification.md lines 14319–14330 (agents plan tree command specification)

The spec states <PLAN_ID> is required and must be a valid ULID.

Expected behavior

When an invalid plan ID (non-ULID format, e.g., a legacy plan name) is passed to agents plan tree, the command should:

  1. Validate the ULID format early
  2. Return an actionable error message explaining the ULID requirement and the legacy/v3 workflow incompatibility

This is consistent with how other v3 commands handle invalid IDs (e.g., plan status, plan execute, plan apply all call _validate_plan_ulid() before querying storage).

Actual behavior (from code analysis)

The tree_decisions_cmd function (lines 3646–3673) does NOT call _validate_plan_ulid() before calling svc.list_decisions(plan_id). This means:

  • A non-ULID plan ID (e.g., a legacy plan name) is passed directly to the decision service
  • The error message will be a generic "No decisions found for plan 'X'" rather than the actionable ULID validation error

Code location

src/cleveragents/cli/commands/plan.py:

  • Lines 3666–3673: tree_decisions_cmd body — missing _validate_plan_ulid(plan_id) call before svc.list_decisions(plan_id)

Compare with plan_status (line 2165), execute_plan (line 1814), lifecycle_apply_plan (line 2009) which all call _validate_plan_ulid().

Steps to reproduce

  1. Run: agents plan tree my-legacy-plan-name
  2. Observe: "No decisions found for plan 'my-legacy-plan-name'." instead of the actionable ULID error

Impact

Minor UX issue — users get a confusing error message instead of an actionable one. Does not block core functionality.

Subtasks

  • Add _validate_plan_ulid(plan_id) call at the start of tree_decisions_cmd
  • Add Behave unit test for invalid ULID error handling
  • Verify nox passes

Definition of Done

  • agents plan tree <non-ulid> returns the standard ULID validation error message
  • Tests pass and coverage ≥ 97%
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `bugfix/plan-tree-ulid-validation` - **Commit Message**: `fix(cli): add ULID validation to plan tree command` - **Milestone**: None (backlog — see note below) - **Parent Epic**: #357 > **Backlog note:** This issue was discovered during autonomous UAT operation > on milestone v3.2.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Bug Report **Feature Area**: plan tree and plan explain CLI Commands (v3.2.0) ### What was tested Code analysis of `src/cleveragents/cli/commands/plan.py`: - Lines 3646–3673: `tree_decisions_cmd` command ### Spec Reference `docs/specification.md` lines 14319–14330 (`agents plan tree` command specification) The spec states `<PLAN_ID>` is required and must be a valid ULID. ### Expected behavior When an invalid plan ID (non-ULID format, e.g., a legacy plan name) is passed to `agents plan tree`, the command should: 1. Validate the ULID format early 2. Return an actionable error message explaining the ULID requirement and the legacy/v3 workflow incompatibility This is consistent with how other v3 commands handle invalid IDs (e.g., `plan status`, `plan execute`, `plan apply` all call `_validate_plan_ulid()` before querying storage). ### Actual behavior (from code analysis) The `tree_decisions_cmd` function (lines 3646–3673) does NOT call `_validate_plan_ulid()` before calling `svc.list_decisions(plan_id)`. This means: - A non-ULID plan ID (e.g., a legacy plan name) is passed directly to the decision service - The error message will be a generic "No decisions found for plan 'X'" rather than the actionable ULID validation error ### Code location `src/cleveragents/cli/commands/plan.py`: - Lines 3666–3673: `tree_decisions_cmd` body — missing `_validate_plan_ulid(plan_id)` call before `svc.list_decisions(plan_id)` Compare with `plan_status` (line 2165), `execute_plan` (line 1814), `lifecycle_apply_plan` (line 2009) which all call `_validate_plan_ulid()`. ### Steps to reproduce 1. Run: `agents plan tree my-legacy-plan-name` 2. Observe: "No decisions found for plan 'my-legacy-plan-name'." instead of the actionable ULID error ### Impact Minor UX issue — users get a confusing error message instead of an actionable one. Does not block core functionality. ## Subtasks - [ ] Add `_validate_plan_ulid(plan_id)` call at the start of `tree_decisions_cmd` - [ ] Add Behave unit test for invalid ULID error handling - [ ] Verify `nox` passes ## Definition of Done - `agents plan tree <non-ulid>` returns the standard ULID validation error message - Tests pass and coverage ≥ 97% - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.2.0 milestone 2026-04-05 07:49:43 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified — clear, well-scoped bug with specific code location and comparison to other commands that already have the fix
  • Priority: Backlog (unchanged) — minor UX issue, does not affect core functionality
  • Milestone: v3.2.0 — plan tree is a v3.2.0 command (Decisions + Validations)
  • MoSCoW: Could Have — this is a UX polish issue (confusing error message vs. actionable one). The command still works correctly for valid ULIDs. Nice to have but not essential.
  • Parent Epic: #357 (referenced in issue body)

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

Issue triaged by project owner: - **State**: Verified — clear, well-scoped bug with specific code location and comparison to other commands that already have the fix - **Priority**: Backlog (unchanged) — minor UX issue, does not affect core functionality - **Milestone**: v3.2.0 — `plan tree` is a v3.2.0 command (Decisions + Validations) - **MoSCoW**: Could Have — this is a UX polish issue (confusing error message vs. actionable one). The command still works correctly for valid ULIDs. Nice to have but not essential. - **Parent Epic**: #357 (referenced in issue body) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo removed this from the v3.2.0 milestone 2026-04-06 20:50:55 +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
Reference
cleveragents/cleveragents-core#3195
No description provided.