feat(plan): implement plan diff using git worktree branch #9231

Closed
opened 2026-04-14 11:54:12 +00:00 by hamza.khyari · 2 comments
Member

Summary

plan diff shows "No changes in changeset" after a successful plan execute, even though the LLM generated file changes that are committed on the worktree branch. The diff command reads from the plan's changeset metadata, which is empty — the actual changes live on the git worktree branch cleveragents/plan-<id>.

Metadata

  • Commit Message: feat(plan): implement plan diff using git worktree branch
  • Branch: feature/plan-diff-worktree

Current Behavior

  1. plan execute writes LLM output to worktree, commits on branch cleveragents/plan-<id>
  2. plan diff reads plan.changeset metadata — which is empty
  3. Output: "No changes in changeset"
  4. User cannot review changes before applying

Expected Behavior

  1. plan diff detects the worktree branch for the plan
  2. Runs git diff HEAD...cleveragents/plan-<id> against the project repo
  3. Displays the diff so the user can review before applying
  4. Falls back to changeset metadata if no worktree branch exists

Subtasks

  • In the diff CLI handler, resolve the plan's linked git-checkout resource
  • Check if branch cleveragents/plan-<id> exists
  • Run git diff HEAD...branch and display the output
  • Fall back to existing changeset-based diff if no branch found

Definition of Done

  • plan diff shows actual file changes from the worktree branch
  • Output matches what git diff would show
  • Scenario-9 passes with visible diff before apply

Spec Reference

specification.md §13225 (Apply sandboxed changes — user reviews before apply)

## Summary `plan diff` shows "No changes in changeset" after a successful `plan execute`, even though the LLM generated file changes that are committed on the worktree branch. The diff command reads from the plan's changeset metadata, which is empty — the actual changes live on the git worktree branch `cleveragents/plan-<id>`. ## Metadata - **Commit Message**: `feat(plan): implement plan diff using git worktree branch` - **Branch**: `feature/plan-diff-worktree` ## Current Behavior 1. `plan execute` writes LLM output to worktree, commits on branch `cleveragents/plan-<id>` 2. `plan diff` reads `plan.changeset` metadata — which is empty 3. Output: "No changes in changeset" 4. User cannot review changes before applying ## Expected Behavior 1. `plan diff` detects the worktree branch for the plan 2. Runs `git diff HEAD...cleveragents/plan-<id>` against the project repo 3. Displays the diff so the user can review before applying 4. Falls back to changeset metadata if no worktree branch exists ## Subtasks - [x] In the diff CLI handler, resolve the plan's linked git-checkout resource - [x] Check if branch `cleveragents/plan-<id>` exists - [x] Run `git diff HEAD...branch` and display the output - [x] Fall back to existing changeset-based diff if no branch found ## Definition of Done - `plan diff` shows actual file changes from the worktree branch - Output matches what `git diff` would show - Scenario-9 passes with visible diff before apply ## Spec Reference `specification.md` §13225 (Apply sandboxed changes — user reviews before apply)
hamza.khyari added this to the v3.5.0 milestone 2026-04-14 11:54:12 +00:00
Owner

@hamza.khyari Thank you for this well-structured feature request.

Acknowledgment — Issue #9231

This issue has been received. The feature request — implementing plan diff to show actual git diff from the worktree branch (cleveragents/plan-<id>) instead of reading from empty changeset metadata — is clear and well-specified.

Labels applied: Type/Feature, Priority/Medium, State/Unverified, MoSCoW/Should have

Current status: State/Unverified — this will be reviewed by the project owner for verification and prioritization.


Automated by CleverAgents Bot
Supervisor: Human Liaison | Agent: human-liaison-pool-supervisor
Worker: [AUTO-HUMAN-9]

@hamza.khyari Thank you for this well-structured feature request. **Acknowledgment — Issue #9231** This issue has been received. The feature request — implementing `plan diff` to show actual git diff from the worktree branch (`cleveragents/plan-<id>`) instead of reading from empty changeset metadata — is clear and well-specified. **Labels applied**: Type/Feature, Priority/Medium, State/Unverified, MoSCoW/Should have **Current status**: State/Unverified — this will be reviewed by the project owner for verification and prioritization. --- **Automated by CleverAgents Bot** Supervisor: Human Liaison | Agent: human-liaison-pool-supervisor Worker: [AUTO-HUMAN-9]
Owner

Triage: Verified [AUTO-OWNR-1]

Valid feature: plan diff currently shows "No changes in changeset" after a successful plan execute because it reads from plan.changeset metadata (which is empty) rather than comparing against the git worktree branch cleveragents/plan-<id>. This is related to #9184 (plan artifacts empty changeset) but addresses the diff command specifically.

The proposed solution — detecting the worktree branch and running git diff HEAD...cleveragents/plan-<id> — is correct and aligns with the spec's requirement for users to review changes before applying.

Assigning to v3.5.0 (Autonomy Hardening) as this is part of the plan lifecycle review workflow. Priority Medium — users can still apply changes without reviewing the diff, but the review step is important for safety.

MoSCoW: Should Have — the ability to diff plan changes before applying is an important safety feature, though not strictly blocking.


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

✅ **Triage: Verified** [AUTO-OWNR-1] Valid feature: `plan diff` currently shows "No changes in changeset" after a successful `plan execute` because it reads from `plan.changeset` metadata (which is empty) rather than comparing against the git worktree branch `cleveragents/plan-<id>`. This is related to #9184 (plan artifacts empty changeset) but addresses the diff command specifically. The proposed solution — detecting the worktree branch and running `git diff HEAD...cleveragents/plan-<id>` — is correct and aligns with the spec's requirement for users to review changes before applying. Assigning to **v3.5.0** (Autonomy Hardening) as this is part of the plan lifecycle review workflow. Priority **Medium** — users can still apply changes without reviewing the diff, but the review step is important for safety. MoSCoW: **Should Have** — the ability to diff plan changes before applying is an important safety feature, though not strictly blocking. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#9231
No description provided.