UAT: agents plan rollback JSON output format does not match spec — multiple field name mismatches and missing fields #3144

Open
opened 2026-04-05 06:51:32 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/backlog-plan-rollback-json-output-format
  • Commit Message: fix(cli): align plan rollback JSON output fields with spec
  • Milestone: (none — backlog)
  • Parent Epic: #368

Backlog note: This issue was discovered during autonomous operation
on milestone v3.3.0 (M4). It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

During UAT testing of the subplans-checkpoints feature area (v3.3.0 M4), a code analysis of src/cleveragents/cli/commands/plan.py lines 3401–3420 revealed that the rollback_plan command's JSON output construction does not match the schema defined in docs/specification.md lines 16044–16077. The functional rollback behaviour (git reset --hard) works correctly; only the JSON output format is wrong.

Current Behavior

The implementation at src/cleveragents/cli/commands/plan.py lines 3401–3420 produces:

data = {
    "rollback_summary": {
        "plan_id": plan_id,           # WRONG: spec uses "plan"
        "from_checkpoint_id": ...,    # WRONG: spec uses "checkpoint"
        "restored_files_count": ...,  # WRONG: spec uses "files_reverted"
        # MISSING: "label" field
    },
    "changes_reverted": result.changed_paths,  # WRONG: flat list of paths, spec uses list of {file, action} objects
    "impact": {
        "files_affected": ...,  # WRONG: spec has different fields
        # MISSING: child_plans_invalidated, sandbox, decisions_after_cp, tool_calls_after_cp
    },
    "post_rollback_state": {
        "active_checkpoint": ...,  # WRONG: spec has phase, state, checkpoints_remaining
        "plan_id": ...,            # WRONG: spec doesn't have this
    },
    # MISSING: "command", "status", "exit_code" envelope
    # MISSING: "timing" field
    "messages": ["Rollback completed successfully."],
}

Specific discrepancies:

  1. rollback_summary.plan_id → should be rollback_summary.plan
  2. rollback_summary.from_checkpoint_id → should be rollback_summary.checkpoint
  3. rollback_summary.restored_files_count → should be rollback_summary.files_reverted
  4. Missing rollback_summary.label field
  5. changes_reverted is a flat list of path strings → should be list of {file, action} objects
  6. impact.files_affected → should be impact.child_plans_invalidated, impact.sandbox, impact.decisions_after_cp, impact.tool_calls_after_cp
  7. post_rollback_state missing phase, state, checkpoints_remaining fields; contains extraneous plan_id field
  8. Missing top-level command, status, exit_code envelope
  9. Missing timing field

Expected Behavior

Per docs/specification.md lines 16044–16077, agents plan rollback --format json must produce:

{
  "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" }
    ],
    "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"]
}

Steps to Reproduce

  1. Create a plan with a sandbox
  2. Create a checkpoint
  3. Run agents plan rollback <PLAN_ID> <CHECKPOINT_ID> --format json
  4. Observe the JSON output does not match the spec format

Subtasks

  • Rename rollback_summary.plan_idrollback_summary.plan
  • Rename rollback_summary.from_checkpoint_idrollback_summary.checkpoint
  • Rename rollback_summary.restored_files_countrollback_summary.files_reverted
  • Add missing rollback_summary.label field (sourced from checkpoint metadata)
  • Reformat changes_reverted from flat path list to list of {file, action} objects
  • Replace impact.files_affected with correct fields: child_plans_invalidated, sandbox, decisions_after_cp, tool_calls_after_cp
  • Fix post_rollback_state to include phase, state, checkpoints_remaining; remove extraneous plan_id
  • Add top-level command, status, exit_code envelope to JSON output
  • Add timing field to JSON output
  • Tests (Behave): Add/update scenarios asserting correct JSON output shape for plan rollback
  • Tests (Robot): Add integration test verifying JSON output against spec schema
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

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 fix(cli): align plan rollback JSON output fields with spec exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch fix/backlog-plan-rollback-json-output-format exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass
  • Coverage >= 97%

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

## Metadata - **Branch**: `fix/backlog-plan-rollback-json-output-format` - **Commit Message**: `fix(cli): align plan rollback JSON output fields with spec` - **Milestone**: *(none — backlog)* - **Parent Epic**: #368 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0 (M4). It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context During UAT testing of the `subplans-checkpoints` feature area (v3.3.0 M4), a code analysis of `src/cleveragents/cli/commands/plan.py` lines 3401–3420 revealed that the `rollback_plan` command's JSON output construction does not match the schema defined in `docs/specification.md` lines 16044–16077. The functional rollback behaviour (git reset --hard) works correctly; only the JSON output format is wrong. ## Current Behavior The implementation at `src/cleveragents/cli/commands/plan.py` lines 3401–3420 produces: ```python data = { "rollback_summary": { "plan_id": plan_id, # WRONG: spec uses "plan" "from_checkpoint_id": ..., # WRONG: spec uses "checkpoint" "restored_files_count": ..., # WRONG: spec uses "files_reverted" # MISSING: "label" field }, "changes_reverted": result.changed_paths, # WRONG: flat list of paths, spec uses list of {file, action} objects "impact": { "files_affected": ..., # WRONG: spec has different fields # MISSING: child_plans_invalidated, sandbox, decisions_after_cp, tool_calls_after_cp }, "post_rollback_state": { "active_checkpoint": ..., # WRONG: spec has phase, state, checkpoints_remaining "plan_id": ..., # WRONG: spec doesn't have this }, # MISSING: "command", "status", "exit_code" envelope # MISSING: "timing" field "messages": ["Rollback completed successfully."], } ``` **Specific discrepancies:** 1. `rollback_summary.plan_id` → should be `rollback_summary.plan` 2. `rollback_summary.from_checkpoint_id` → should be `rollback_summary.checkpoint` 3. `rollback_summary.restored_files_count` → should be `rollback_summary.files_reverted` 4. Missing `rollback_summary.label` field 5. `changes_reverted` is a flat list of path strings → should be list of `{file, action}` objects 6. `impact.files_affected` → should be `impact.child_plans_invalidated`, `impact.sandbox`, `impact.decisions_after_cp`, `impact.tool_calls_after_cp` 7. `post_rollback_state` missing `phase`, `state`, `checkpoints_remaining` fields; contains extraneous `plan_id` field 8. Missing top-level `command`, `status`, `exit_code` envelope 9. Missing `timing` field ## Expected Behavior Per `docs/specification.md` lines 16044–16077, `agents plan rollback --format json` must produce: ```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" } ], "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"] } ``` ## Steps to Reproduce 1. Create a plan with a sandbox 2. Create a checkpoint 3. Run `agents plan rollback <PLAN_ID> <CHECKPOINT_ID> --format json` 4. Observe the JSON output does not match the spec format ## Subtasks - [ ] Rename `rollback_summary.plan_id` → `rollback_summary.plan` - [ ] Rename `rollback_summary.from_checkpoint_id` → `rollback_summary.checkpoint` - [ ] Rename `rollback_summary.restored_files_count` → `rollback_summary.files_reverted` - [ ] Add missing `rollback_summary.label` field (sourced from checkpoint metadata) - [ ] Reformat `changes_reverted` from flat path list to list of `{file, action}` objects - [ ] Replace `impact.files_affected` with correct fields: `child_plans_invalidated`, `sandbox`, `decisions_after_cp`, `tool_calls_after_cp` - [ ] Fix `post_rollback_state` to include `phase`, `state`, `checkpoints_remaining`; remove extraneous `plan_id` - [ ] Add top-level `command`, `status`, `exit_code` envelope to JSON output - [ ] Add `timing` field to JSON output - [ ] Tests (Behave): Add/update scenarios asserting correct JSON output shape for `plan rollback` - [ ] Tests (Robot): Add integration test verifying JSON output against spec schema - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## 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 `fix(cli): align plan rollback JSON output fields with spec` exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch `fix/backlog-plan-rollback-json-output-format` exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass - Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.3.0 milestone 2026-04-05 06:57:52 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog — the rollback functionality works correctly; only the JSON output format is wrong
  • Milestone: v3.3.0 (M4: Corrections + Subplans + Checkpoints) — plan rollback is a core M4 feature
  • MoSCoW: Should Have — the spec defines the exact JSON output format for agents plan rollback. The functional behavior is correct but the output format has 9 discrepancies from the spec. This is a spec compliance issue that should be fixed but doesn't block the core rollback functionality.
  • Parent Epic: #368

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog — the rollback functionality works correctly; only the JSON output format is wrong - **Milestone**: v3.3.0 (M4: Corrections + Subplans + Checkpoints) — plan rollback is a core M4 feature - **MoSCoW**: Should Have — the spec defines the exact JSON output format for `agents plan rollback`. The functional behavior is correct but the output format has 9 discrepancies from the spec. This is a spec compliance issue that should be fixed but doesn't block the core rollback functionality. - **Parent Epic**: #368 --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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.

Blocks
#368 Epic: Subplans & Parallelism
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3144
No description provided.