UAT: agents plan rollback JSON output uses wrong field names — diverges from spec-required schema #6256

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

Bug Report

Summary

The agents plan rollback --format json output uses field names that do not match those required by the specification. Additionally, the RollbackResult domain model is missing several spec-required fields, causing the CLI to silently omit them from output.

Expected Behavior (per specification §agents plan rollback)

The spec requires the following JSON structure:

{
  "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": [...],
    "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": "...", "duration_ms": 1850 },
  "messages": ["Rollback complete"]
}

Actual Behavior

The implementation in src/cleveragents/cli/commands/plan.py (lines ~4023-4044) produces:

{
  "rollback_summary": {
    "plan_id": "...",
    "from_checkpoint_id": "...",
    "restored_files_count": 6
  },
  "changes_reverted": [...],
  "impact": {
    "files_affected": 6
  },
  "post_rollback_state": {
    "active_checkpoint": "...",
    "plan_id": "..."
  },
  "timing": { "elapsed_seconds": 1.234 },
  "messages": ["Rollback completed successfully."]
}

Specific Divergences

  1. Missing outer command/status/exit_code/data envelope — spec wraps all data in a standard command envelope; implementation dumps the dict directly.
  2. rollback_summary.plan should be plan_id → spec uses "plan" key.
  3. rollback_summary.checkpoint should be from_checkpoint_id → spec uses "checkpoint" key.
  4. rollback_summary.files_reverted should be restored_files_count → spec uses "files_reverted" key.
  5. rollback_summary.label is missing entirely — spec requires a human-readable checkpoint label.
  6. impact.child_plans_invalidated is missing — implementation uses files_affected instead (not in spec).
  7. impact.sandbox is missing from the JSON output (present only in Rich display).
  8. impact.decisions_after_cp and impact.tool_calls_after_cp are missing from JSON output.
  9. post_rollback_state.phase and post_rollback_state.state are missing — implementation uses active_checkpoint and plan_id instead.
  10. post_rollback_state.checkpoints_remaining is missing.
  11. timing.duration_ms is spec-required but implementation uses elapsed_seconds.

Root Cause

The RollbackResult domain model (src/cleveragents/domain/models/core/checkpoint.py) only carries:

  • restored_files_count
  • changed_paths
  • from_checkpoint_id

It is missing: label, phase, state, checkpoints_remaining, child_plans_invalidated, decisions_after_cp, tool_calls_after_cp, and sandbox.

The CLI at src/cleveragents/cli/commands/plan.py uses getattr(result, ...) with None fallbacks for these missing fields, so they are silently omitted in both JSON and Rich outputs.

Code Locations

  • src/cleveragents/cli/commands/plan.pyrollback_plan() function (lines ~4020–4050)
  • src/cleveragents/domain/models/core/checkpoint.pyRollbackResult class (lines ~161–191)
  • src/cleveragents/application/services/checkpoint_service.pyrollback_to_checkpoint() return value

Steps to Reproduce

agents plan rollback --yes --format json <PLAN_ID> <CHECKPOINT_ID>

Observe that the JSON output does not match the spec schema.


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

## Bug Report ### Summary The `agents plan rollback --format json` output uses field names that do not match those required by the specification. Additionally, the `RollbackResult` domain model is missing several spec-required fields, causing the CLI to silently omit them from output. ### Expected Behavior (per specification §agents plan rollback) The spec requires the following JSON structure: ```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": [...], "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": "...", "duration_ms": 1850 }, "messages": ["Rollback complete"] } ``` ### Actual Behavior The implementation in `src/cleveragents/cli/commands/plan.py` (lines ~4023-4044) produces: ```json { "rollback_summary": { "plan_id": "...", "from_checkpoint_id": "...", "restored_files_count": 6 }, "changes_reverted": [...], "impact": { "files_affected": 6 }, "post_rollback_state": { "active_checkpoint": "...", "plan_id": "..." }, "timing": { "elapsed_seconds": 1.234 }, "messages": ["Rollback completed successfully."] } ``` ### Specific Divergences 1. **Missing outer `command`/`status`/`exit_code`/`data` envelope** — spec wraps all data in a standard command envelope; implementation dumps the dict directly. 2. **`rollback_summary.plan`** should be `plan_id` → spec uses `"plan"` key. 3. **`rollback_summary.checkpoint`** should be `from_checkpoint_id` → spec uses `"checkpoint"` key. 4. **`rollback_summary.files_reverted`** should be `restored_files_count` → spec uses `"files_reverted"` key. 5. **`rollback_summary.label`** is missing entirely — spec requires a human-readable checkpoint label. 6. **`impact.child_plans_invalidated`** is missing — implementation uses `files_affected` instead (not in spec). 7. **`impact.sandbox`** is missing from the JSON output (present only in Rich display). 8. **`impact.decisions_after_cp`** and **`impact.tool_calls_after_cp`** are missing from JSON output. 9. **`post_rollback_state.phase`** and **`post_rollback_state.state`** are missing — implementation uses `active_checkpoint` and `plan_id` instead. 10. **`post_rollback_state.checkpoints_remaining`** is missing. 11. **`timing.duration_ms`** is spec-required but implementation uses `elapsed_seconds`. ### Root Cause The `RollbackResult` domain model (`src/cleveragents/domain/models/core/checkpoint.py`) only carries: - `restored_files_count` - `changed_paths` - `from_checkpoint_id` It is missing: `label`, `phase`, `state`, `checkpoints_remaining`, `child_plans_invalidated`, `decisions_after_cp`, `tool_calls_after_cp`, and `sandbox`. The CLI at `src/cleveragents/cli/commands/plan.py` uses `getattr(result, ...)` with `None` fallbacks for these missing fields, so they are silently omitted in both JSON and Rich outputs. ### Code Locations - `src/cleveragents/cli/commands/plan.py` — `rollback_plan()` function (lines ~4020–4050) - `src/cleveragents/domain/models/core/checkpoint.py` — `RollbackResult` class (lines ~161–191) - `src/cleveragents/application/services/checkpoint_service.py` — `rollback_to_checkpoint()` return value ### Steps to Reproduce ```bash agents plan rollback --yes --format json <PLAN_ID> <CHECKPOINT_ID> ``` Observe that the JSON output does not match the spec schema. --- **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#6256
No description provided.