UAT: agents plan diff --correction <ID> incorrectly requires positional <PLAN_ID> argument #2041

Open
opened 2026-04-03 03:13:36 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: fix/plan-diff-correction-mutually-exclusive-arg
  • Commit Message: fix(cli): make plan_id optional when --correction is provided in plan diff
  • Milestone: v3.7.0
  • Parent Epic: #358

Description

The agents plan diff command requires a positional <PLAN_ID> argument even when --correction is provided. According to the specification (§15322–15332), --correction and <PLAN_ID> are mutually exclusive — the user provides one OR the other, never both.

Spec-Defined Command Signature

agents plan diff (--correction <CORRECTION_ATTEMPT_ID>|<PLAN_ID>)

This is a mutually exclusive group:

  • agents plan diff <PLAN_ID> — show diff for a plan
  • agents plan diff --correction <CORRECTION_ATTEMPT_ID> — show diff for a correction attempt (no plan_id needed)

The spec example (§15322–15332) shows:

$ agents plan diff --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8

(no plan_id argument)

Actual Behavior

The implementation in src/cleveragents/cli/commands/plan.py (line ~2725) defines plan_id as a required positional argument:

@app.command("diff")
def plan_diff(
    plan_id: Annotated[
        str,
        typer.Argument(help="Plan ID to show diff for"),  # REQUIRED positional
    ],
    correction: Annotated[
        str | None,
        typer.Option("--correction", ...),
    ] = None,
    ...

This forces users to supply a dummy plan_id even when using --correction:

# This fails (missing required plan_id):
agents plan diff --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8

# User is forced to provide a meaningless dummy:
agents plan diff DUMMY_PLAN_ID --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8

Steps to Reproduce

  1. Run agents plan diff --correction <some_correction_id>
  2. Observe the command fails with "Missing argument 'PLAN_ID'"

Code Location

src/cleveragents/cli/commands/plan.py, function plan_diff (line ~2725)

Subtasks

  • Make plan_id optional (str | None, default None) in plan_diff
  • Add runtime validation: exactly one of plan_id or --correction must be provided (mutually exclusive)
  • Update error messages when neither or both are provided (clear, actionable messages)
  • Write BDD (Behave) TDD issue-capture scenario tagged @tdd_expected_fail demonstrating the bug before the fix
  • Write BDD scenarios covering all four cases: plan_id only, --correction only, both provided (error), neither provided (error)

Definition of Done

  • agents plan diff --correction <ID> works without a plan_id argument
  • agents plan diff <PLAN_ID> still works as before
  • Providing both <PLAN_ID> and --correction produces a clear, user-friendly error
  • Providing neither <PLAN_ID> nor --correction produces a clear, user-friendly error
  • All new behaviour is covered by BDD scenarios in features/
  • All existing tests pass
  • All nox stages pass (nox -e lint, nox -e typecheck, nox -e unit_tests, nox -e integration_tests)
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/plan-diff-correction-mutually-exclusive-arg` - **Commit Message**: `fix(cli): make plan_id optional when --correction is provided in plan diff` - **Milestone**: v3.7.0 - **Parent Epic**: #358 ## Description The `agents plan diff` command requires a positional `<PLAN_ID>` argument even when `--correction` is provided. According to the specification (§15322–15332), `--correction` and `<PLAN_ID>` are **mutually exclusive** — the user provides one OR the other, never both. ### Spec-Defined Command Signature ``` agents plan diff (--correction <CORRECTION_ATTEMPT_ID>|<PLAN_ID>) ``` This is a mutually exclusive group: - `agents plan diff <PLAN_ID>` — show diff for a plan - `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` — show diff for a correction attempt (**no `plan_id` needed**) The spec example (§15322–15332) shows: ```bash $ agents plan diff --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8 ``` (no `plan_id` argument) ### Actual Behavior The implementation in `src/cleveragents/cli/commands/plan.py` (line ~2725) defines `plan_id` as a **required** positional argument: ```python @app.command("diff") def plan_diff( plan_id: Annotated[ str, typer.Argument(help="Plan ID to show diff for"), # REQUIRED positional ], correction: Annotated[ str | None, typer.Option("--correction", ...), ] = None, ... ``` This forces users to supply a dummy `plan_id` even when using `--correction`: ```bash # This fails (missing required plan_id): agents plan diff --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8 # User is forced to provide a meaningless dummy: agents plan diff DUMMY_PLAN_ID --correction 01HXM9B7Z3Q1Q8K2E9H7K3W2M8 ``` ### Steps to Reproduce 1. Run `agents plan diff --correction <some_correction_id>` 2. Observe the command fails with `"Missing argument 'PLAN_ID'"` ### Code Location `src/cleveragents/cli/commands/plan.py`, function `plan_diff` (line ~2725) ## Subtasks - [ ] Make `plan_id` optional (`str | None`, default `None`) in `plan_diff` - [ ] Add runtime validation: exactly one of `plan_id` or `--correction` must be provided (mutually exclusive) - [ ] Update error messages when neither or both are provided (clear, actionable messages) - [ ] Write BDD (Behave) TDD issue-capture scenario tagged `@tdd_expected_fail` demonstrating the bug before the fix - [ ] Write BDD scenarios covering all four cases: `plan_id` only, `--correction` only, both provided (error), neither provided (error) ## Definition of Done - [ ] `agents plan diff --correction <ID>` works without a `plan_id` argument - [ ] `agents plan diff <PLAN_ID>` still works as before - [ ] Providing both `<PLAN_ID>` and `--correction` produces a clear, user-friendly error - [ ] Providing neither `<PLAN_ID>` nor `--correction` produces a clear, user-friendly error - [ ] All new behaviour is covered by BDD scenarios in `features/` - [ ] All existing tests pass - [ ] All nox stages pass (`nox -e lint`, `nox -e typecheck`, `nox -e unit_tests`, `nox -e integration_tests`) - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 03:16:40 +00:00
freemo self-assigned this 2026-04-03 16:58:14 +00:00
Author
Owner

Label compliance fix applied:

  • Removed conflicting label: State/Unverified
  • Kept: State/Verified
  • Reason: Issue had two conflicting State/* labels. Per CONTRIBUTING.md, only one State/* label is permitted. Kept the more advanced state (State/Verified).

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

Label compliance fix applied: - Removed conflicting label: `State/Unverified` - Kept: `State/Verified` - Reason: Issue had two conflicting `State/*` labels. Per CONTRIBUTING.md, only one `State/*` label is permitted. Kept the more advanced state (`State/Verified`). --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
Author
Owner

Label compliance fix applied:

  • Removed conflicting label: State/Unverified
  • Retained: State/Verified
  • Reason: Issue had two conflicting State/* labels simultaneously. Per CONTRIBUTING.md, only one State/* label is permitted. State/Verified is the more advanced state and has been retained.

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

Label compliance fix applied: - Removed conflicting label: `State/Unverified` - Retained: `State/Verified` - Reason: Issue had two conflicting `State/*` labels simultaneously. Per CONTRIBUTING.md, only one `State/*` label is permitted. `State/Verified` is the more advanced state and has been retained. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-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.

Blocks
Reference
cleveragents/cleveragents-core#2041
No description provided.