UAT: agents plan diff --correction is a stub — shows placeholder message instead of spec-required correction diff output #3795

Open
opened 2026-04-06 06:22:51 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/backlog-plan-diff-correction-stub
  • Commit Message: fix(cli): implement correction diff output for agents plan diff --correction
  • Milestone: (backlog — no milestone assigned)
  • Parent Epic: #372

Background and context

The agents plan diff --correction <CORRECTION_ATTEMPT_ID> command is a stub that shows a placeholder message "Correction diff will be available after M4.2." instead of the spec-required correction diff output. The stub message references "M4.2" which is a past milestone, indicating this was never implemented. This leaves the agents plan correct workflow incomplete, as users cannot compare the original vs corrected decision artifacts.

Current behavior (for bugs)

The command shows a stub panel instead of the actual diff:

╭─ Correction Diff ─────────────────────────────────────────────────╮
│ Correction Attempt: <CORRECTION_ATTEMPT_ID>                       │
│ Plan: <PLAN_ID>                                                    │
│                                                                    │
│ Correction diff will be available after M4.2.                     │
╰───────────────────────────────────────────────────────────────────╯

Code location: src/cleveragents/cli/commands/plan.py lines ~2964-2975:

if correction:
    # Show correction-specific diff (stub: shows info panel)
    console.print(
        Panel(
            f"[bold]Correction Attempt:[/bold] {correction}\n"
            f"[bold]Plan:[/bold] {plan_id}\n\n"
            "[dim]Correction diff will be available after M4.2.[/dim]",
            title="Correction Diff",
            expand=False,
        )
    )
    return

Steps to reproduce:

  1. Create a plan and run it through execute phase
  2. Apply a correction with agents plan correct --mode revert -g "guidance" <PLAN_ID>
  3. Run agents plan diff --correction <CORRECTION_ATTEMPT_ID>
  4. Observe stub message instead of actual diff

Expected behavior

When --correction is provided, the command should show:

  • A "Correction Diff" panel with: Correction ID, Original Decision ID, Mode (revert/append), Files Changed, New Insertions, New Deletions
  • A "Comparison" table showing before/after changes per file
  • A "Patch Preview" panel showing the actual diff between original and corrected versions
  • Status message: ✓ OK Correction diff generated

The JSON output should follow:

{
  "command": "plan diff",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "correction_diff": {
      "correction": "<CORRECTION_ATTEMPT_ID>",
      "original_decision": "...",
      "mode": "revert",
      "files_changed": 3,
      "new_insertions": 18,
      "new_deletions": 6
    },
    "comparison": [...],
    "patch_preview": [...]
  },
  "timing": {...},
  "messages": ["Correction diff generated"]
}

Acceptance criteria

  • agents plan diff --correction <ID> shows spec-required Correction Diff panel, Comparison table, and Patch Preview panel
  • All output formats (rich, plain, json, yaml) match spec examples
  • Correction diff lookup reads from correction_attempts table (see spec §28775)
  • Comparison between original and corrected changeset is computed correctly
  • Patch preview generation produces accurate diff between original and corrected versions

Supporting information

  • Spec reference: §agents plan diff, §28775 (correction_attempts table)
  • Related: agents plan correct command workflow
  • Impact: Users cannot compare original vs corrected decision artifacts; agents plan correct workflow is incomplete without correction diff

Subtasks

  • Implement correction diff lookup from correction_attempts table (see spec §28775)
  • Implement comparison between original and corrected changeset
  • Implement patch preview generation for correction diff
  • Render Correction Diff panel, Comparison table, and Patch Preview panel in rich output
  • Support all output formats (rich, plain, json, yaml) matching spec examples
  • Add BDD test (Behave) verifying correction diff output matches spec for all output formats
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • agents plan diff --correction <ID> shows spec-required correction diff output (Correction Diff panel, Comparison table, Patch Preview panel)
  • All output formats (rich, plain, json, yaml) match spec examples
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass
  • Coverage >= 97%

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 correction diff output for agents plan diff --correction` - **Milestone**: *(backlog — no milestone assigned)* - **Parent Epic**: #372 ## Background and context The `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` command is a stub that shows a placeholder message `"Correction diff will be available after M4.2."` instead of the spec-required correction diff output. The stub message references "M4.2" which is a past milestone, indicating this was never implemented. This leaves the `agents plan correct` workflow incomplete, as users cannot compare the original vs corrected decision artifacts. ## Current behavior (for bugs) The command shows a stub panel instead of the actual diff: ``` ╭─ Correction Diff ─────────────────────────────────────────────────╮ │ Correction Attempt: <CORRECTION_ATTEMPT_ID> │ │ Plan: <PLAN_ID> │ │ │ │ Correction diff will be available after M4.2. │ ╰───────────────────────────────────────────────────────────────────╯ ``` **Code location:** `src/cleveragents/cli/commands/plan.py` lines ~2964-2975: ```python if correction: # Show correction-specific diff (stub: shows info panel) console.print( Panel( f"[bold]Correction Attempt:[/bold] {correction}\n" f"[bold]Plan:[/bold] {plan_id}\n\n" "[dim]Correction diff will be available after M4.2.[/dim]", title="Correction Diff", expand=False, ) ) return ``` **Steps to reproduce:** 1. Create a plan and run it through execute phase 2. Apply a correction with `agents plan correct --mode revert -g "guidance" <PLAN_ID>` 3. Run `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` 4. Observe stub message instead of actual diff ## Expected behavior When `--correction` is provided, the command should show: - A **"Correction Diff"** panel with: Correction ID, Original Decision ID, Mode (revert/append), Files Changed, New Insertions, New Deletions - A **"Comparison"** table showing before/after changes per file - A **"Patch Preview"** panel showing the actual diff between original and corrected versions - Status message: `✓ OK Correction diff generated` The JSON output should follow: ```json { "command": "plan diff", "status": "ok", "exit_code": 0, "data": { "correction_diff": { "correction": "<CORRECTION_ATTEMPT_ID>", "original_decision": "...", "mode": "revert", "files_changed": 3, "new_insertions": 18, "new_deletions": 6 }, "comparison": [...], "patch_preview": [...] }, "timing": {...}, "messages": ["Correction diff generated"] } ``` ## Acceptance criteria - `agents plan diff --correction <ID>` shows spec-required Correction Diff panel, Comparison table, and Patch Preview panel - All output formats (rich, plain, json, yaml) match spec examples - Correction diff lookup reads from `correction_attempts` table (see spec §28775) - Comparison between original and corrected changeset is computed correctly - Patch preview generation produces accurate diff between original and corrected versions ## Supporting information - Spec reference: §agents plan diff, §28775 (correction_attempts table) - Related: `agents plan correct` command workflow - Impact: Users cannot compare original vs corrected decision artifacts; `agents plan correct` workflow is incomplete without correction diff ## Subtasks - [ ] Implement correction diff lookup from `correction_attempts` table (see spec §28775) - [ ] Implement comparison between original and corrected changeset - [ ] Implement patch preview generation for correction diff - [ ] Render Correction Diff panel, Comparison table, and Patch Preview panel in rich output - [ ] Support all output formats (rich, plain, json, yaml) matching spec examples - [ ] Add BDD test (Behave) verifying correction diff output matches spec for all output formats - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `agents plan diff --correction <ID>` shows spec-required correction diff output (Correction Diff panel, Comparison table, Patch Preview panel) - All output formats (rich, plain, json, yaml) match spec examples - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass - Coverage >= 97% > **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
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#3795
No description provided.