[BUG] agents plan diff --correction CORRECTION_ATTEMPT_ID returns stub panel instead of actual correction diff #9346

Open
opened 2026-04-14 15:17:49 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(cli): implement plan diff --correction to show actual correction attempt diff instead of stub
  • Branch: fix/plan-diff-correction-stub

Background and Context

The agents plan diff --correction <CORRECTION_ATTEMPT_ID> command displays a stub panel with the message "Correction diff will be available after M4.2." instead of the actual correction diff data. The spec (§CLI Commands — agents plan diff, docs/specification.md lines 15525–15595) defines a full correction diff output with comparison table, patch preview, and correction metadata.

This was discovered during UAT testing of the Plan Diff and Artifacts CLI feature area.

Current Behavior

In src/cleveragents/cli/commands/plan.py, the plan_diff() command (line 3265) has a stub branch for --correction:

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

This stub is returned for ALL output formats (rich, plain, json, yaml), meaning machine-readable formats also return a stub panel instead of structured data.

Expected Behavior

Per docs/specification.md §agents plan diff (lines 15525–15595), when --correction is provided, the output must show:

Rich format:

╭─ Correction Diff ───────────────────────────────╮
│ Correction: 01HXM9B7Z3Q1Q8K2E9H7K3W2M8          │
│ Original Decision: 01HXM9A1C2Q7W3R5..           │
│ Mode: revert                                    │
│ Files Changed: 3                                │
│ New Insertions: 18                              │
│ New Deletions: 6                                │
╰─────────────────────────────────────────────────╯

╭─ Comparison ─────────────────────────────────────────────────────╮
│ File                  Before (original)  After (corrected)       │
│ src/payments/api.py   +12 -4            +18 -6 (expanded)        │
│ src/auth/tokens.py    +8 -2             (unchanged)              │
╰──────────────────────────────────────────────────────────────────╯

JSON format must include a full spec envelope with command, status, exit_code, data (containing correction metadata, comparison table, patch preview), timing, messages.

The spec also shows the command syntax as:

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

Note: --correction takes a CORRECTION_ATTEMPT_ID OR a PLAN_ID — the current implementation's --correction option help text says "Show diff for a specific correction attempt ID" but the spec shows it can also accept a PLAN_ID.

Acceptance Criteria

  • agents plan diff --correction <CORRECTION_ATTEMPT_ID> shows actual correction diff data (not a stub)
  • Output includes: Correction ID, Original Decision ID, Mode, Files Changed, New Insertions, New Deletions
  • Output includes a Comparison table showing before/after for each file
  • Output includes a Patch Preview section
  • --format json returns a spec-compliant JSON envelope (not a stub panel)
  • --format plain returns plain text correction diff (not a stub panel)
  • --format yaml returns YAML correction diff (not a stub panel)

Supporting Information

  • Spec reference: docs/specification.md lines 15525–15595
  • Implementation stub: src/cleveragents/cli/commands/plan.pyplan_diff() lines 3296–3307
  • The stub comment says "Correction diff will be available after M4.2." — M4.2 work is now due
  • Related: docs/adr/ADR-034-decision-tree-versioning-and-history.md lines 184, 208 reference agents plan diff --correction as a key debugging tool
  • Feature file: features/plan_diff_artifacts.feature has no scenario for --correction flag (gap in test coverage)

Subtasks

  • Implement CorrectionDiffService or extend PlanApplyService to retrieve correction attempt changeset
  • Implement correction diff rendering for rich, plain, json, yaml formats
  • Update plan_diff() CLI command to call the real correction diff service instead of returning stub
  • Add features/plan_diff_artifacts.feature scenarios for --correction flag (all output formats)
  • Add step definitions for correction diff scenarios
  • Tests (Behave): Add scenarios for correction diff with valid and invalid correction IDs
  • Run nox -s unit_tests -- features/plan_diff_artifacts.feature, fix any errors
  • Verify coverage ≥97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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 details.
  • 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.

Automated by CleverAgents Bot Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(cli): implement plan diff --correction to show actual correction attempt diff instead of stub` - **Branch**: `fix/plan-diff-correction-stub` ## Background and Context The `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` command displays a stub panel with the message "Correction diff will be available after M4.2." instead of the actual correction diff data. The spec (§CLI Commands — agents plan diff, `docs/specification.md` lines 15525–15595) defines a full correction diff output with comparison table, patch preview, and correction metadata. This was discovered during UAT testing of the Plan Diff and Artifacts CLI feature area. ## Current Behavior In `src/cleveragents/cli/commands/plan.py`, the `plan_diff()` command (line 3265) has a stub branch for `--correction`: ```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 ``` This stub is returned for ALL output formats (rich, plain, json, yaml), meaning machine-readable formats also return a stub panel instead of structured data. ## Expected Behavior Per `docs/specification.md` §agents plan diff (lines 15525–15595), when `--correction` is provided, the output must show: **Rich format:** ``` ╭─ Correction Diff ───────────────────────────────╮ │ Correction: 01HXM9B7Z3Q1Q8K2E9H7K3W2M8 │ │ Original Decision: 01HXM9A1C2Q7W3R5.. │ │ Mode: revert │ │ Files Changed: 3 │ │ New Insertions: 18 │ │ New Deletions: 6 │ ╰─────────────────────────────────────────────────╯ ╭─ Comparison ─────────────────────────────────────────────────────╮ │ File Before (original) After (corrected) │ │ src/payments/api.py +12 -4 +18 -6 (expanded) │ │ src/auth/tokens.py +8 -2 (unchanged) │ ╰──────────────────────────────────────────────────────────────────╯ ``` **JSON format** must include a full spec envelope with `command`, `status`, `exit_code`, `data` (containing correction metadata, comparison table, patch preview), `timing`, `messages`. The spec also shows the command syntax as: ``` agents plan diff (--correction <CORRECTION_ATTEMPT_ID>|<PLAN_ID>) ``` Note: `--correction` takes a `CORRECTION_ATTEMPT_ID` OR a `PLAN_ID` — the current implementation's `--correction` option help text says "Show diff for a specific correction attempt ID" but the spec shows it can also accept a PLAN_ID. ## Acceptance Criteria - `agents plan diff --correction <CORRECTION_ATTEMPT_ID>` shows actual correction diff data (not a stub) - Output includes: Correction ID, Original Decision ID, Mode, Files Changed, New Insertions, New Deletions - Output includes a Comparison table showing before/after for each file - Output includes a Patch Preview section - `--format json` returns a spec-compliant JSON envelope (not a stub panel) - `--format plain` returns plain text correction diff (not a stub panel) - `--format yaml` returns YAML correction diff (not a stub panel) ## Supporting Information - Spec reference: `docs/specification.md` lines 15525–15595 - Implementation stub: `src/cleveragents/cli/commands/plan.py` — `plan_diff()` lines 3296–3307 - The stub comment says "Correction diff will be available after M4.2." — M4.2 work is now due - Related: `docs/adr/ADR-034-decision-tree-versioning-and-history.md` lines 184, 208 reference `agents plan diff --correction` as a key debugging tool - Feature file: `features/plan_diff_artifacts.feature` has no scenario for `--correction` flag (gap in test coverage) ## Subtasks - [ ] Implement `CorrectionDiffService` or extend `PlanApplyService` to retrieve correction attempt changeset - [ ] Implement correction diff rendering for rich, plain, json, yaml formats - [ ] Update `plan_diff()` CLI command to call the real correction diff service instead of returning stub - [ ] Add `features/plan_diff_artifacts.feature` scenarios for `--correction` flag (all output formats) - [ ] Add step definitions for correction diff scenarios - [ ] Tests (Behave): Add scenarios for correction diff with valid and invalid correction IDs - [ ] Run `nox -s unit_tests -- features/plan_diff_artifacts.feature`, fix any errors - [ ] Verify coverage ≥97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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 details. - 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. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.3.0 milestone 2026-04-14 15:24:14 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: agents plan diff --correction CORRECTION_ATTEMPT_ID returns a stub panel with "Correction diff will be available after M4.2." instead of the actual correction diff data. The stub is returned for ALL output formats (rich, plain, json, yaml). This is a critical gap in the correction workflow — users cannot review correction diffs before applying them.

Assigning to v3.3.0 (Corrections + Subplans + Checkpoints) as the correction diff is a core M4 feature. Priority High — the correction diff is completely non-functional.

MoSCoW: Must Have — the correction diff is essential for users to review changes before applying corrections. Without it, the correction workflow is blind.


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

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: `agents plan diff --correction CORRECTION_ATTEMPT_ID` returns a stub panel with "Correction diff will be available after M4.2." instead of the actual correction diff data. The stub is returned for ALL output formats (rich, plain, json, yaml). This is a critical gap in the correction workflow — users cannot review correction diffs before applying them. Assigning to **v3.3.0** (Corrections + Subplans + Checkpoints) as the correction diff is a core M4 feature. Priority **High** — the correction diff is completely non-functional. MoSCoW: **Must Have** — the correction diff is essential for users to review changes before applying corrections. Without it, the correction workflow is blind. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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.

Dependencies

No dependencies set.

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