UAT: agents plan diff --correction is a stub — shows info panel instead of real correction diff #3829

Closed
opened 2026-04-06 06:49:19 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/backlog-plan-diff-correction-stub
  • Commit Message: fix(cli): implement real correction diff in agents plan diff --correction
  • Milestone: (backlog — no milestone)
  • Parent Epic: #397

Background and Context

The agents plan diff --correction <CORRECTION_ATTEMPT_ID> command is documented in the specification as showing the difference between the original plan and the state after a correction has been applied. However, the current implementation is a stub that only shows an info panel with the correction attempt ID.

Per docs/specification.md (§ agents plan diff):

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

The --correction variant should show the diff between the original plan state and the corrected plan state, identified by the CORRECTION_ATTEMPT_ID.

Current Behavior

When agents plan diff --correction <CORRECTION_ATTEMPT_ID> is invoked, the CLI shows a Rich info panel with the text:

Correction Attempt: <CORRECTION_ATTEMPT_ID>
Correction diff not yet implemented.

This is confirmed by the comment in src/cleveragents/cli/commands/plan.py at line 2950:

# Show correction-specific diff (stub: shows info panel)

Expected Behavior (from spec)

The command should:

  1. Look up the CorrectionAttemptRecord by CORRECTION_ATTEMPT_ID from the CorrectionAttemptRepository
  2. Retrieve the original decision and the new decision from the correction attempt record
  3. Compute and display a unified diff showing what changed between the original plan state and the corrected plan state
  4. Support --format json|yaml|plain|table|rich output formats

The spec (§ agents plan diff) shows example output including file-level diffs of the changeset produced after the correction was applied.

Steps to Reproduce

  1. Create a plan and execute it to generate decisions
  2. Apply a correction: agents plan correct <DECISION_ID> --mode revert --guidance "test"
  3. Run: agents plan diff --correction <CORRECTION_ATTEMPT_ID>
  4. Observe: info panel shown instead of actual diff

Code Location

  • src/cleveragents/cli/commands/plan.pydiff() function, line 2918 (@app.command("diff"))
  • Line 2950: # Show correction-specific diff (stub: shows info panel)
  • The CorrectionAttemptRepository exists in src/cleveragents/infrastructure/database/repositories.py (line 5781) and can be used to look up the correction attempt

Subtasks

  • Look up CorrectionAttemptRecord by CORRECTION_ATTEMPT_ID via CorrectionAttemptRepository
  • Retrieve original and new decision IDs from the record
  • Compute diff between original and corrected plan states
  • Render diff output in all supported formats
  • Add Behave BDD test for the correction diff rendering

Definition of Done

  • agents plan diff --correction <ID> shows a real diff (not an info panel stub)
  • The diff reflects the actual changes introduced by the correction
  • All output formats (--format json|yaml|plain|table|rich) work correctly
  • Behave unit tests cover the correction diff path
  • nox -e unit_tests passes
  • nox -e typecheck passes

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


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

## Metadata - **Branch**: `fix/backlog-plan-diff-correction-stub` - **Commit Message**: `fix(cli): implement real correction diff in agents plan diff --correction` - **Milestone**: *(backlog — no milestone)* - **Parent Epic**: #397 ## Background and Context The `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` command is documented in the specification as showing the difference between the original plan and the state after a correction has been applied. However, the current implementation is a stub that only shows an info panel with the correction attempt ID. Per `docs/specification.md` (§ agents plan diff): ``` agents plan diff (--correction <CORRECTION_ATTEMPT_ID>|<PLAN_ID>) ``` The `--correction` variant should show the diff between the original plan state and the corrected plan state, identified by the `CORRECTION_ATTEMPT_ID`. ## Current Behavior When `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` is invoked, the CLI shows a Rich info panel with the text: ``` Correction Attempt: <CORRECTION_ATTEMPT_ID> Correction diff not yet implemented. ``` This is confirmed by the comment in `src/cleveragents/cli/commands/plan.py` at line 2950: ```python # Show correction-specific diff (stub: shows info panel) ``` ## Expected Behavior (from spec) The command should: 1. Look up the `CorrectionAttemptRecord` by `CORRECTION_ATTEMPT_ID` from the `CorrectionAttemptRepository` 2. Retrieve the original decision and the new decision from the correction attempt record 3. Compute and display a unified diff showing what changed between the original plan state and the corrected plan state 4. Support `--format json|yaml|plain|table|rich` output formats The spec (§ agents plan diff) shows example output including file-level diffs of the changeset produced after the correction was applied. ## Steps to Reproduce 1. Create a plan and execute it to generate decisions 2. Apply a correction: `agents plan correct <DECISION_ID> --mode revert --guidance "test"` 3. Run: `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` 4. Observe: info panel shown instead of actual diff ## Code Location - `src/cleveragents/cli/commands/plan.py` — `diff()` function, line 2918 (`@app.command("diff")`) - Line 2950: `# Show correction-specific diff (stub: shows info panel)` - The `CorrectionAttemptRepository` exists in `src/cleveragents/infrastructure/database/repositories.py` (line 5781) and can be used to look up the correction attempt ## Subtasks - [ ] Look up `CorrectionAttemptRecord` by `CORRECTION_ATTEMPT_ID` via `CorrectionAttemptRepository` - [ ] Retrieve original and new decision IDs from the record - [ ] Compute diff between original and corrected plan states - [ ] Render diff output in all supported formats - [ ] Add Behave BDD test for the correction diff rendering ## Definition of Done - [ ] `agents plan diff --correction <ID>` shows a real diff (not an info panel stub) - [ ] The diff reflects the actual changes introduced by the correction - [ ] All output formats (`--format json|yaml|plain|table|rich`) work correctly - [ ] Behave unit tests cover the correction diff path - [ ] `nox -e unit_tests` passes - [ ] `nox -e typecheck` passes > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Duplicate of #3795

This issue covers the same problem as #3795: agents plan diff --correction is a stub showing a placeholder message instead of the spec-required correction diff output. Issue #3795 was filed earlier (2026-04-06T06:22:51Z vs this issue at 2026-04-06T06:49:19Z) and contains a more detailed spec analysis including the expected JSON output format. Closing as a duplicate — please track the fix in #3795.


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

**Duplicate of #3795** This issue covers the same problem as #3795: `agents plan diff --correction` is a stub showing a placeholder message instead of the spec-required correction diff output. Issue #3795 was filed earlier (2026-04-06T06:22:51Z vs this issue at 2026-04-06T06:49:19Z) and contains a more detailed spec analysis including the expected JSON output format. Closing as a duplicate — please track the fix in #3795. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
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
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3829
No description provided.