UAT: agents plan apply JSON/YAML output uses flat _plan_spec_dict instead of spec-required structured data with artifacts/changes/validation/sandbox_cleanup/lifecycle fields #6469

Open
opened 2026-04-09 21:07:25 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area

Plan Lifecycle — agents plan apply JSON/YAML output

Spec Reference

docs/specification.md §13319–13402 (agents plan apply JSON/YAML output)

Expected Behavior (from spec)

The spec defines the following JSON output structure for agents plan apply:

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

Actual Behavior

The implementation in lifecycle_apply_plan() (src/cleveragents/cli/commands/plan.py, lines 2617–2619):

if fmt != OutputFormat.RICH.value:
    data = _plan_spec_dict(plan)
    console.print(format_output(data, fmt))

_plan_spec_dict(plan) returns a flat plan dict with fields like plan_id, namespaced_name, phase, processing_state, etc. — but missing the spec-required structured apply output fields:

  • data.artifacts (number of files updated)
  • data.changes (insertions/deletions as nested dict)
  • data.project (project name)
  • data.applied_at (timestamp)
  • data.validation (tests, lint, type_check, duration_s)
  • data.sandbox_cleanup (worktree, branch, checkpoint)
  • data.lifecycle (phase, state, total_duration, total_cost, decisions_made, child_plans)
  • command field is empty string "" instead of "plan apply"

Code Location

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

  • Lines 2617–2619: lifecycle_apply_plan() non-rich output path — uses _plan_spec_dict() instead of spec-required structured dict

Steps to Reproduce

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

Observe: flat plan dict without artifacts, changes, validation, sandbox_cleanup, lifecycle fields.

Severity

Medium — downstream automation tools that parse agents --format json plan apply output will fail to find the structured fields defined in the spec.


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

## Bug Report ### Feature Area Plan Lifecycle — `agents plan apply` JSON/YAML output ### Spec Reference `docs/specification.md` §13319–13402 (agents plan apply JSON/YAML output) ### Expected Behavior (from spec) The spec defines the following JSON output structure for `agents plan apply`: ```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"] } ``` ### Actual Behavior The implementation in `lifecycle_apply_plan()` (`src/cleveragents/cli/commands/plan.py`, lines 2617–2619): ```python if fmt != OutputFormat.RICH.value: data = _plan_spec_dict(plan) console.print(format_output(data, fmt)) ``` `_plan_spec_dict(plan)` returns a flat plan dict with fields like `plan_id`, `namespaced_name`, `phase`, `processing_state`, etc. — but **missing** the spec-required structured apply output fields: - ❌ `data.artifacts` (number of files updated) - ❌ `data.changes` (insertions/deletions as nested dict) - ❌ `data.project` (project name) - ❌ `data.applied_at` (timestamp) - ❌ `data.validation` (tests, lint, type_check, duration_s) - ❌ `data.sandbox_cleanup` (worktree, branch, checkpoint) - ❌ `data.lifecycle` (phase, state, total_duration, total_cost, decisions_made, child_plans) - ❌ `command` field is empty string `""` instead of `"plan apply"` ### Code Location `src/cleveragents/cli/commands/plan.py`: - Lines 2617–2619: `lifecycle_apply_plan()` non-rich output path — uses `_plan_spec_dict()` instead of spec-required structured dict ### Steps to Reproduce ```bash agents --format json plan apply --yes <PLAN_ID> ``` Observe: flat plan dict without `artifacts`, `changes`, `validation`, `sandbox_cleanup`, `lifecycle` fields. ### Severity Medium — downstream automation tools that parse `agents --format json plan apply` output will fail to find the structured fields defined in the spec. --- **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#6469
No description provided.