UAT: agents plan rollback JSON output uses wrong field names and is missing required fields — plan_id/from_checkpoint_id/restored_files_count vs spec's plan/checkpoint/files_reverted #2545

Open
opened 2026-04-03 18:51:15 +00:00 by freemo · 2 comments
Owner

Bug Report

What was tested

The agents plan rollback JSON output format vs the specification.

Expected behavior (from spec)

Per docs/specification.md §agents plan rollback, the JSON output must be:

{
  "command": "plan rollback",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "rollback_summary": {
      "plan": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
      "checkpoint": "cp_01HXM8C2",
      "label": "before auth refactor",
      "files_reverted": 6
    },
    "changes_reverted": [
      { "file": "src/auth/session.py", "action": "restored" },
      { "file": "src/auth/tokens.py", "action": "restored" },
      { "file": "tests/test_session.py", "action": "removed" }
    ],
    "impact": {
      "child_plans_invalidated": 2,
      "sandbox": "restored to cp_01HXM8C2",
      "decisions_after_cp": "2 discarded",
      "tool_calls_after_cp": "5 undone"
    },
    "post_rollback_state": {
      "phase": "execute",
      "state": "queued (awaiting input)",
      "checkpoints_remaining": 2
    }
  },
  "timing": { "started": "2025-06-15T10:37:00Z", "duration_ms": 1850 },
  "messages": ["Rollback complete"]
}

Actual behavior (from code)

In src/cleveragents/cli/commands/plan.py (lines 3366–3384), the JSON output is:

data = {
    "rollback_summary": {
        "plan_id": plan_id,                              # ← should be "plan"
        "from_checkpoint_id": result.from_checkpoint_id, # ← should be "checkpoint"
        "restored_files_count": result.restored_files_count, # ← should be "files_reverted"
    },
    "changes_reverted": result.changed_paths,  # ← list of strings, not {file, action} objects
    "impact": {
        "files_affected": result.restored_files_count,  # ← wrong field name
    },
    "post_rollback_state": {
        "active_checkpoint": result.from_checkpoint_id,  # ← wrong field name
        "plan_id": plan_id,
    },
    "timing": { "elapsed_seconds": round(elapsed, 3) },
    "messages": ["Rollback completed successfully."],
}

Field name mismatches in rollback_summary:

  • plan_id → should be plan
  • from_checkpoint_id → should be checkpoint
  • restored_files_count → should be files_reverted

Missing fields:

  • rollback_summary.label — checkpoint label (e.g., "before auth refactor")
  • impact.child_plans_invalidated — number of child plans invalidated
  • impact.sandbox — sandbox restore description
  • impact.decisions_after_cp — decisions discarded
  • impact.tool_calls_after_cp — tool calls undone
  • post_rollback_state.phase — current phase after rollback
  • post_rollback_state.state — current state after rollback
  • post_rollback_state.checkpoints_remaining — remaining checkpoints

Wrong structure in changes_reverted:

  • Implementation: list of path strings (result.changed_paths)
  • Spec: list of {"file": "...", "action": "restored|removed"} objects

Missing envelope fields:

  • command, status, exit_code top-level fields

Impact

Any tooling parsing agents plan rollback --format json will receive a completely different structure than documented. The field name mismatches mean automated scripts cannot reliably extract rollback results.

Code location

src/cleveragents/cli/commands/plan.py, function rollback_plan, lines ~3366–3384.


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

## Bug Report ### What was tested The `agents plan rollback` JSON output format vs the specification. ### Expected behavior (from spec) Per `docs/specification.md` §`agents plan rollback`, the JSON output must be: ```json { "command": "plan rollback", "status": "ok", "exit_code": 0, "data": { "rollback_summary": { "plan": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "checkpoint": "cp_01HXM8C2", "label": "before auth refactor", "files_reverted": 6 }, "changes_reverted": [ { "file": "src/auth/session.py", "action": "restored" }, { "file": "src/auth/tokens.py", "action": "restored" }, { "file": "tests/test_session.py", "action": "removed" } ], "impact": { "child_plans_invalidated": 2, "sandbox": "restored to cp_01HXM8C2", "decisions_after_cp": "2 discarded", "tool_calls_after_cp": "5 undone" }, "post_rollback_state": { "phase": "execute", "state": "queued (awaiting input)", "checkpoints_remaining": 2 } }, "timing": { "started": "2025-06-15T10:37:00Z", "duration_ms": 1850 }, "messages": ["Rollback complete"] } ``` ### Actual behavior (from code) In `src/cleveragents/cli/commands/plan.py` (lines 3366–3384), the JSON output is: ```python data = { "rollback_summary": { "plan_id": plan_id, # ← should be "plan" "from_checkpoint_id": result.from_checkpoint_id, # ← should be "checkpoint" "restored_files_count": result.restored_files_count, # ← should be "files_reverted" }, "changes_reverted": result.changed_paths, # ← list of strings, not {file, action} objects "impact": { "files_affected": result.restored_files_count, # ← wrong field name }, "post_rollback_state": { "active_checkpoint": result.from_checkpoint_id, # ← wrong field name "plan_id": plan_id, }, "timing": { "elapsed_seconds": round(elapsed, 3) }, "messages": ["Rollback completed successfully."], } ``` **Field name mismatches in `rollback_summary`:** - `plan_id` → should be `plan` - `from_checkpoint_id` → should be `checkpoint` - `restored_files_count` → should be `files_reverted` **Missing fields:** - `rollback_summary.label` — checkpoint label (e.g., "before auth refactor") - `impact.child_plans_invalidated` — number of child plans invalidated - `impact.sandbox` — sandbox restore description - `impact.decisions_after_cp` — decisions discarded - `impact.tool_calls_after_cp` — tool calls undone - `post_rollback_state.phase` — current phase after rollback - `post_rollback_state.state` — current state after rollback - `post_rollback_state.checkpoints_remaining` — remaining checkpoints **Wrong structure in `changes_reverted`:** - Implementation: list of path strings (`result.changed_paths`) - Spec: list of `{"file": "...", "action": "restored|removed"}` objects **Missing envelope fields:** - `command`, `status`, `exit_code` top-level fields ### Impact Any tooling parsing `agents plan rollback --format json` will receive a completely different structure than documented. The field name mismatches mean automated scripts cannot reliably extract rollback results. ### Code location `src/cleveragents/cli/commands/plan.py`, function `rollback_plan`, lines ~3366–3384. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.5.0 milestone 2026-04-05 05:06:35 +00:00
Author
Owner

This issue has been moved to the backlog as part of an aggressive grooming of the v3.5.0 milestone. It has been deemed non-critical for the minimal viability of the milestone and will be addressed in a future release.

This issue has been moved to the backlog as part of an aggressive grooming of the v3.5.0 milestone. It has been deemed non-critical for the minimal viability of the milestone and will be addressed in a future release.
Author
Owner

This issue has been moved to the backlog as part of an aggressive grooming of the v3.5.0 milestone. It has been deemed non-critical for the minimal viability of the milestone and will be addressed in a future release.

This issue has been moved to the backlog as part of an aggressive grooming of the v3.5.0 milestone. It has been deemed non-critical for the minimal viability of the milestone and will be addressed in a future release.
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#2545
No description provided.