UAT: agents plan apply --format json returns generic plan status dict instead of spec-required apply schema with artifacts, changes, sandbox_cleanup, and lifecycle fields #6830

Open
opened 2026-04-10 02:24:20 +00:00 by HAL9000 · 0 comments
Owner

What Was Tested

Code analysis of agents plan apply <PLAN_ID> --format json output schema against the specification (§ agents plan apply, lines 13321–13357).

Expected Behavior (from spec)

{
  "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": "...", "duration_ms": 1250 },
  "messages": ["Changes applied"]
}

Actual Behavior

lifecycle_apply_plan() in src/cleveragents/cli/commands/plan.py calls _plan_spec_dict(plan) (line 2618) which returns the generic plan status fields:

{
  "plan_id": "...",
  "namespaced_name": "...",
  "phase": "apply",
  "processing_state": "applied",
  "state": "applied",
  "project_links": [...],
  "arguments": {},
  "automation_profile": "...",
  "action_name": "...",
  "created_at": "...",
  "updated_at": "...",
  "is_terminal": true
}

Field-by-field comparison:

Spec field Actual Status
data.artifacts (integer count) Missing Absent
data.changes.insertions Missing Absent
data.changes.deletions Missing Absent
data.project Missing Absent
data.applied_at Missing Absent
data.validation (with test/lint/type_check results) Missing Absent
data.sandbox_cleanup (worktree, branch, checkpoint status) Missing Absent
data.lifecycle (phase, state, total_duration, total_cost, decisions_made, child_plans) Partially present (phase, processing_state) but missing total_duration, total_cost, decisions_made, child_plans Incomplete

The sandbox_cleanup object is particularly important for the Sandbox & Checkpoints feature area — it should confirm that the git worktree was removed, the branch was merged, and the checkpoint was archived after apply. This information is not surfaced at all in the current JSON output.

Steps to Reproduce

agents plan apply --yes <PLAN_ID> --format json

Observe that the response contains generic plan status fields rather than the apply-specific schema required by the spec.

Code Location

src/cleveragents/cli/commands/plan.pylifecycle_apply_plan(), line 2618:

data = _plan_spec_dict(plan)
console.print(format_output(data, fmt))

The fix requires either modifying lifecycle_apply_plan to build an apply-specific output dict (including sandbox cleanup results), or creating a dedicated _apply_spec_dict() builder.


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

## What Was Tested Code analysis of `agents plan apply <PLAN_ID> --format json` output schema against the specification (§ `agents plan apply`, lines 13321–13357). ## Expected Behavior (from spec) ```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": "...", "duration_ms": 1250 }, "messages": ["Changes applied"] } ``` ## Actual Behavior `lifecycle_apply_plan()` in `src/cleveragents/cli/commands/plan.py` calls `_plan_spec_dict(plan)` (line 2618) which returns the **generic plan status fields**: ```json { "plan_id": "...", "namespaced_name": "...", "phase": "apply", "processing_state": "applied", "state": "applied", "project_links": [...], "arguments": {}, "automation_profile": "...", "action_name": "...", "created_at": "...", "updated_at": "...", "is_terminal": true } ``` Field-by-field comparison: | Spec field | Actual | Status | |---|---|---| | `data.artifacts` (integer count) | Missing | **Absent** | | `data.changes.insertions` | Missing | **Absent** | | `data.changes.deletions` | Missing | **Absent** | | `data.project` | Missing | **Absent** | | `data.applied_at` | Missing | **Absent** | | `data.validation` (with test/lint/type_check results) | Missing | **Absent** | | `data.sandbox_cleanup` (worktree, branch, checkpoint status) | Missing | **Absent** | | `data.lifecycle` (phase, state, total_duration, total_cost, decisions_made, child_plans) | Partially present (`phase`, `processing_state`) but missing `total_duration`, `total_cost`, `decisions_made`, `child_plans` | **Incomplete** | The `sandbox_cleanup` object is particularly important for the Sandbox & Checkpoints feature area — it should confirm that the git worktree was removed, the branch was merged, and the checkpoint was archived after apply. This information is not surfaced at all in the current JSON output. ## Steps to Reproduce ```bash agents plan apply --yes <PLAN_ID> --format json ``` Observe that the response contains generic plan status fields rather than the apply-specific schema required by the spec. ## Code Location `src/cleveragents/cli/commands/plan.py` — `lifecycle_apply_plan()`, line 2618: ```python data = _plan_spec_dict(plan) console.print(format_output(data, fmt)) ``` The fix requires either modifying `lifecycle_apply_plan` to build an apply-specific output dict (including sandbox cleanup results), or creating a dedicated `_apply_spec_dict()` builder. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 02:24:35 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:37 +00:00
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#6830
No description provided.