UAT: agents plan cancel --format json does not produce spec-required JSON envelope #4975

Open
opened 2026-04-08 23:41:48 +00:00 by freemo · 1 comment
Owner

Bug Report

Feature Area: Plan Lifecycle — agents plan cancel
Severity: Medium
Discovered by: UAT tester (uat-worker-plan-lifecycle)

What Was Tested

The JSON output format of agents plan cancel <PLAN_ID> --format json.

Expected Behavior (from spec §agents plan cancel)

The spec requires a structured JSON envelope with cancellation details:

{
  "command": "plan cancel",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "phase": "execute",
    "reason": "blocked on credentials",
    "state": "cancelled",
    "cancelled_at": "13:02:15",
    "sandbox": {
      "status": "preserved",
      "files_modified": 3,
      "checkpoints": 2
    },
    "child_plans": {
      "completed": 1,
      "cancelled": 1,
      "artifacts_preserved": true
    },
    "recovery": [
      "Resolve credentials",
      "Run agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J"
    ]
  },
  "timing": { "started": "2026-02-08T13:02:15Z", "duration_ms": 340 },
  "messages": ["Plan cancelled"]
}

Actual Behavior (from code analysis)

The cancel_plan command at src/cleveragents/cli/commands/plan.py lines 2807-2811 outputs _plan_spec_dict(plan) when fmt != "rich":

data = _plan_spec_dict(plan)
if reason:
    data["cancel_reason"] = reason
console.print(format_output(data, fmt))

_plan_spec_dict() returns the internal plan representation and is missing all spec-required cancel-specific fields:

  • data.cancelled_at (timestamp of cancellation)
  • data.sandbox (status/files_modified/checkpoints)
  • data.child_plans (completed/cancelled/artifacts_preserved)
  • data.recovery (list of recovery suggestions)
  • command, status, exit_code, timing, messages envelope (missing)

Note: The code uses cancel_reason but the spec uses reason as the field name.

Code Location

  • src/cleveragents/cli/commands/plan.py, lines 2807-2811 (cancel_plan function)

Steps to Reproduce

agents plan cancel <PLAN_ID> --reason "blocked on credentials" --format json

Impact

Any tooling or scripts that parse agents plan cancel --format json output will fail. The recovery field is particularly important for automated workflows that need to know how to recover from a cancelled plan.


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

## Bug Report **Feature Area**: Plan Lifecycle — `agents plan cancel` **Severity**: Medium **Discovered by**: UAT tester (uat-worker-plan-lifecycle) ### What Was Tested The JSON output format of `agents plan cancel <PLAN_ID> --format json`. ### Expected Behavior (from spec §agents plan cancel) The spec requires a structured JSON envelope with cancellation details: ```json { "command": "plan cancel", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "phase": "execute", "reason": "blocked on credentials", "state": "cancelled", "cancelled_at": "13:02:15", "sandbox": { "status": "preserved", "files_modified": 3, "checkpoints": 2 }, "child_plans": { "completed": 1, "cancelled": 1, "artifacts_preserved": true }, "recovery": [ "Resolve credentials", "Run agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J" ] }, "timing": { "started": "2026-02-08T13:02:15Z", "duration_ms": 340 }, "messages": ["Plan cancelled"] } ``` ### Actual Behavior (from code analysis) The `cancel_plan` command at `src/cleveragents/cli/commands/plan.py` lines 2807-2811 outputs `_plan_spec_dict(plan)` when `fmt != "rich"`: ```python data = _plan_spec_dict(plan) if reason: data["cancel_reason"] = reason console.print(format_output(data, fmt)) ``` `_plan_spec_dict()` returns the internal plan representation and is missing all spec-required cancel-specific fields: - `data.cancelled_at` (timestamp of cancellation) - `data.sandbox` (status/files_modified/checkpoints) - `data.child_plans` (completed/cancelled/artifacts_preserved) - `data.recovery` (list of recovery suggestions) - `command`, `status`, `exit_code`, `timing`, `messages` envelope (missing) Note: The code uses `cancel_reason` but the spec uses `reason` as the field name. ### Code Location - `src/cleveragents/cli/commands/plan.py`, lines 2807-2811 (`cancel_plan` function) ### Steps to Reproduce ```bash agents plan cancel <PLAN_ID> --reason "blocked on credentials" --format json ``` ### Impact Any tooling or scripts that parse `agents plan cancel --format json` output will fail. The `recovery` field is particularly important for automated workflows that need to know how to recover from a cancelled plan. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 00:53:18 +00:00
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — JSON output envelope is required by the spec for all CLI commands; missing envelope breaks any tooling or scripts parsing CLI output
  • Milestone: v3.2.0 (plan commands are core plan lifecycle)
  • Story Points: 3 — M — Fix requires wrapping existing output in the standard JSON envelope
  • MoSCoW: Must Have — The spec explicitly requires the JSON envelope format for all --format json output; this is a spec compliance bug
  • Parent Epic: #4958 (Decision Recording Epic covers plan output formats)

This is a valid spec compliance bug. Part of a batch of JSON envelope bugs across plan commands (see also #4964, #4969, #4970, #4974, #4975, #4976).


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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — JSON output envelope is required by the spec for all CLI commands; missing envelope breaks any tooling or scripts parsing CLI output - **Milestone**: v3.2.0 (plan commands are core plan lifecycle) - **Story Points**: 3 — M — Fix requires wrapping existing output in the standard JSON envelope - **MoSCoW**: Must Have — The spec explicitly requires the JSON envelope format for all `--format json` output; this is a spec compliance bug - **Parent Epic**: #4958 (Decision Recording Epic covers plan output formats) This is a valid spec compliance bug. Part of a batch of JSON envelope bugs across plan commands (see also #4964, #4969, #4970, #4974, #4975, #4976). --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#4975
No description provided.