UAT: agents plan diff JSON/YAML output missing spec-required command envelope and diff content fields #6257

Open
opened 2026-04-09 18:19:13 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Summary

The agents plan diff --format json output is missing the spec-required standard command envelope (command, status, exit_code, data, timing, messages). Additionally, the data payload uses an internal changeset structure instead of the spec-required diff summary structure with insertions/deletions counts, actual patch hunks, project name, net change, and risk assessment.

Expected Behavior (per specification §agents plan diff)

The spec requires the following JSON structure:

{
  "command": "plan diff",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "diff_summary": {
      "plan": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
      "project": "local/api-service",
      "files_changed": 2,
      "insertions": 12,
      "deletions": 4,
      "net_change": "+8 lines"
    },
    "files": [
      { "path": "src/auth/session.py", "change": "+8 -2", "status": "modified" },
      { "path": "src/auth/tokens.py", "change": "+4 -2", "status": "modified" }
    ],
    "patch_preview": [
      {
        "file": "src/auth/session.py",
        "hunks": [
          { "range": "@@ -12,4 +12,10 @@", "deletions": [...], "insertions": [...] }
        ]
      }
    ],
    "risk_assessment": {
      "api_compatibility": "preserved",
      "test_coverage": "maintained",
      "breaking_changes": "none detected"
    }
  },
  "timing": { "started": "...", "duration_ms": 750 },
  "messages": ["Diff generated"]
}

Actual Behavior

The diff() method in src/cleveragents/application/services/plan_apply_service.py (lines ~286–355) calls _render_diff_json() which returns:

{
  "changeset_id": "...",
  "plan_id": "...",
  "total_changes": 2,
  "summary": { ... },
  "entries": [
    {
      "path": "src/auth/session.py",
      "operation": "modify",
      "before_hash": "abc123...",
      "after_hash": "def456...",
      "resource_id": "...",
      "tool_name": "...",
      "timestamp": "..."
    }
  ]
}

This is the raw ChangeSet internal data structure, not the spec-required user-facing diff format.

Specific Divergences

  1. No command envelope — spec requires command, status, exit_code, data, timing, messages wrapper; implementation returns raw data.
  2. No diff_summary — spec requires a diff_summary dict with plan, project, files_changed, insertions, deletions, net_change; implementation uses changeset_id, plan_id, total_changes.
  3. No insertions/deletions counts — the spec requires line-level diff statistics; implementation only has hash-based references (before_hash, after_hash).
  4. No project field — spec requires the project name in the diff summary.
  5. No patch_preview — spec requires actual patch hunks with range, deletions[], insertions[]; implementation has no actual diff content.
  6. No risk_assessment — spec requires api_compatibility, test_coverage, breaking_changes; this is entirely missing.
  7. files[] format wrong — spec requires {path, change ("+8 -2"), status ("modified"/"created"/"deleted")}; implementation has entries[{path, operation, before_hash, after_hash, ...}].

Code Locations

  • src/cleveragents/application/services/plan_apply_service.py:
    • PlanApplyService.diff() (lines ~286–355)
    • _render_diff_json() (lines ~180–210)
    • _render_diff_rich() and _render_diff_plain() also lack spec-required fields

Steps to Reproduce

agents plan diff --format json <PLAN_ID>

Observe that the output does not match the spec schema and is missing actual diff content.


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

## Bug Report ### Summary The `agents plan diff --format json` output is missing the spec-required standard command envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`). Additionally, the data payload uses an internal changeset structure instead of the spec-required diff summary structure with insertions/deletions counts, actual patch hunks, project name, net change, and risk assessment. ### Expected Behavior (per specification §agents plan diff) The spec requires the following JSON structure: ```json { "command": "plan diff", "status": "ok", "exit_code": 0, "data": { "diff_summary": { "plan": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "project": "local/api-service", "files_changed": 2, "insertions": 12, "deletions": 4, "net_change": "+8 lines" }, "files": [ { "path": "src/auth/session.py", "change": "+8 -2", "status": "modified" }, { "path": "src/auth/tokens.py", "change": "+4 -2", "status": "modified" } ], "patch_preview": [ { "file": "src/auth/session.py", "hunks": [ { "range": "@@ -12,4 +12,10 @@", "deletions": [...], "insertions": [...] } ] } ], "risk_assessment": { "api_compatibility": "preserved", "test_coverage": "maintained", "breaking_changes": "none detected" } }, "timing": { "started": "...", "duration_ms": 750 }, "messages": ["Diff generated"] } ``` ### Actual Behavior The `diff()` method in `src/cleveragents/application/services/plan_apply_service.py` (lines ~286–355) calls `_render_diff_json()` which returns: ```json { "changeset_id": "...", "plan_id": "...", "total_changes": 2, "summary": { ... }, "entries": [ { "path": "src/auth/session.py", "operation": "modify", "before_hash": "abc123...", "after_hash": "def456...", "resource_id": "...", "tool_name": "...", "timestamp": "..." } ] } ``` This is the raw ChangeSet internal data structure, not the spec-required user-facing diff format. ### Specific Divergences 1. **No command envelope** — spec requires `command`, `status`, `exit_code`, `data`, `timing`, `messages` wrapper; implementation returns raw data. 2. **No `diff_summary`** — spec requires a `diff_summary` dict with `plan`, `project`, `files_changed`, `insertions`, `deletions`, `net_change`; implementation uses `changeset_id`, `plan_id`, `total_changes`. 3. **No `insertions`/`deletions` counts** — the spec requires line-level diff statistics; implementation only has hash-based references (`before_hash`, `after_hash`). 4. **No `project` field** — spec requires the project name in the diff summary. 5. **No `patch_preview`** — spec requires actual patch hunks with `range`, `deletions[]`, `insertions[]`; implementation has no actual diff content. 6. **No `risk_assessment`** — spec requires `api_compatibility`, `test_coverage`, `breaking_changes`; this is entirely missing. 7. **`files[]` format wrong** — spec requires `{path, change ("+8 -2"), status ("modified"/"created"/"deleted")}`; implementation has `entries[{path, operation, before_hash, after_hash, ...}]`. ### Code Locations - `src/cleveragents/application/services/plan_apply_service.py`: - `PlanApplyService.diff()` (lines ~286–355) - `_render_diff_json()` (lines ~180–210) - `_render_diff_rich()` and `_render_diff_plain()` also lack spec-required fields ### Steps to Reproduce ```bash agents plan diff --format json <PLAN_ID> ``` Observe that the output does not match the spec schema and is missing actual diff content. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: 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.

Dependencies

No dependencies set.

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