UAT: agents plan apply --format json output missing spec envelope and apply-specific sections #5052

Closed
opened 2026-04-09 00:51:29 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Plan Lifecycle — agents plan apply

Summary

agents plan apply <PLAN_ID> --format json returns a raw plan data dict instead of the spec-required JSON envelope. The output is missing the command, status, exit_code, timing, and messages top-level fields, and the data section is missing apply-specific fields like artifacts, changes, validation, sandbox_cleanup, lifecycle, and next_steps.

Expected Behavior (from spec)

Per docs/specification.md §agents plan apply, the JSON output for a successful apply must be:

{
  "command": "plan apply",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "artifacts": 6,
    "changes": { "insertions": 42, "deletions": 9 },
    "project": "local/api-service",
    "applied_at": "2026-02-08T13:04:00Z",
    "validation": {
      "tests": { "status": "passed", "passed": 24, "total": 24 },
      "lint": { "status": "passed", "warnings": 0 },
      "type_check": { "status": "passed", "errors": 0 },
      "duration_s": 12.4
    },
    "sandbox_cleanup": {
      "worktree": "removed",
      "branch": "merged to main",
      "checkpoint": "archived"
    },
    "lifecycle": {
      "phase": "apply",
      "state": "applied",
      "total_duration": "00:06:14",
      "total_cost": "$0.0847",
      "decisions_made": 8,
      "child_plans": 2
    }
  },
  "timing": { "started": "2026-02-09T14:30:00Z", "duration_ms": 1250 },
  "messages": ["Changes applied"]
}

For a failed apply (validation failures), the spec requires status: "error", exit_code: 1, and a recovery_options array.

Actual Behavior

In src/cleveragents/cli/commands/plan.py, the lifecycle_apply_plan command (lines 2158–2306) calls _plan_spec_dict(plan) and passes it directly to format_output. This produces:

  1. No top-level envelope: No command, status, exit_code, timing, messages fields
  2. Missing artifacts count: Number of files updated not included
  3. Missing changes section: Insertions/deletions not included
  4. Missing validation section: Test/lint/type-check results not included
  5. Missing sandbox_cleanup section: Worktree/branch/checkpoint cleanup status not included
  6. Missing lifecycle section: Total duration, cost, decisions made, child plans not included
  7. Missing next_steps: No "Review git diff" / "Commit changes" guidance
  8. No error differentiation: Failed applies don't return status: "error" or recovery_options

Code Location

src/cleveragents/cli/commands/plan.py:

  • lifecycle_apply_plan function (lines 2158–2306)

Impact

Programmatic consumers of agents plan apply --format json cannot determine whether the apply succeeded or failed from the JSON output alone (no status field), and cannot access validation results or recovery options.


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

## Bug Report **Feature Area:** Plan Lifecycle — `agents plan apply` ### Summary `agents plan apply <PLAN_ID> --format json` returns a raw plan data dict instead of the spec-required JSON envelope. The output is missing the `command`, `status`, `exit_code`, `timing`, and `messages` top-level fields, and the `data` section is missing apply-specific fields like `artifacts`, `changes`, `validation`, `sandbox_cleanup`, `lifecycle`, and `next_steps`. ### Expected Behavior (from spec) Per `docs/specification.md` §agents plan apply, the JSON output for a successful apply must be: ```json { "command": "plan apply", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "artifacts": 6, "changes": { "insertions": 42, "deletions": 9 }, "project": "local/api-service", "applied_at": "2026-02-08T13:04:00Z", "validation": { "tests": { "status": "passed", "passed": 24, "total": 24 }, "lint": { "status": "passed", "warnings": 0 }, "type_check": { "status": "passed", "errors": 0 }, "duration_s": 12.4 }, "sandbox_cleanup": { "worktree": "removed", "branch": "merged to main", "checkpoint": "archived" }, "lifecycle": { "phase": "apply", "state": "applied", "total_duration": "00:06:14", "total_cost": "$0.0847", "decisions_made": 8, "child_plans": 2 } }, "timing": { "started": "2026-02-09T14:30:00Z", "duration_ms": 1250 }, "messages": ["Changes applied"] } ``` For a failed apply (validation failures), the spec requires `status: "error"`, `exit_code: 1`, and a `recovery_options` array. ### Actual Behavior In `src/cleveragents/cli/commands/plan.py`, the `lifecycle_apply_plan` command (lines 2158–2306) calls `_plan_spec_dict(plan)` and passes it directly to `format_output`. This produces: 1. **No top-level envelope**: No `command`, `status`, `exit_code`, `timing`, `messages` fields 2. **Missing `artifacts` count**: Number of files updated not included 3. **Missing `changes` section**: Insertions/deletions not included 4. **Missing `validation` section**: Test/lint/type-check results not included 5. **Missing `sandbox_cleanup` section**: Worktree/branch/checkpoint cleanup status not included 6. **Missing `lifecycle` section**: Total duration, cost, decisions made, child plans not included 7. **Missing `next_steps`**: No "Review git diff" / "Commit changes" guidance 8. **No error differentiation**: Failed applies don't return `status: "error"` or `recovery_options` ### Code Location `src/cleveragents/cli/commands/plan.py`: - `lifecycle_apply_plan` function (lines 2158–2306) ### Impact Programmatic consumers of `agents plan apply --format json` cannot determine whether the apply succeeded or failed from the JSON output alone (no `status` field), and cannot access validation results or recovery options. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Closing as duplicate of #4715 — both issues report the same problem: agents plan apply --format json output missing spec-required envelope.


Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Closing as duplicate of #4715 — both issues report the same problem: `agents plan apply --format json` output missing spec-required envelope. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#5052
No description provided.