UAT: agents plan tree --format json does not produce spec-required JSON envelope #4976

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

Bug Report

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

What Was Tested

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

Expected Behavior (from spec §agents plan tree)

The spec requires a structured JSON envelope with decision tree data:

{
  "command": "plan tree",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "tree": {
      "type": "prompt_definition",
      "description": "Increase test coverage to 85%",
      "children": [...]
    },
    "summary": {
      "nodes": 9,
      "depth": 3,
      "child_plans": "2+",
      "invariants": 2,
      "superseded": 0
    },
    "child_plans": [
      { "id": "01HXM9F1A", "phase": "execute", "state": "processing" },
      { "id": "01HXM9F2B", "phase": "execute", "state": "queued" }
    ],
    "decision_ids": {
      "root": "01HXM9A0B1Q2W3R5G8Z0P4Q1X8",
      ...
    }
  },
  "timing": { "started": "2026-02-08T12:58:00Z", "duration_ms": 85 },
  "messages": ["Decision tree rendered"]
}

Actual Behavior (from code analysis)

The tree_decisions_cmd command at src/cleveragents/cli/commands/plan.py line 4029-4030 outputs the raw tree list when fmt in (OutputFormat.JSON, OutputFormat.YAML):

if fmt in (OutputFormat.JSON, OutputFormat.YAML):
    console.print(format_output(tree_data, fmt))

This outputs a raw list of tree nodes without the required envelope. Missing fields:

  • command, status, exit_code, timing, messages envelope
  • data.plan_id (the plan ID being queried)
  • data.tree (the tree is output directly, not nested under data.tree)
  • data.summary (nodes count, depth, child_plans count, invariants, superseded count)
  • data.child_plans (list of child plan IDs with their phase/state)
  • data.decision_ids (named map of key decision IDs)

Code Location

  • src/cleveragents/cli/commands/plan.py, lines 4029-4030 (tree_decisions_cmd function)

Steps to Reproduce

agents plan tree <PLAN_ID> --format json

Impact

Any tooling or scripts that parse agents plan tree --format json output will fail. The summary and child_plans fields are particularly important for understanding plan complexity and tracking child plan execution.


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

## Bug Report **Feature Area**: Plan Lifecycle — `agents plan tree` **Severity**: Medium **Discovered by**: UAT tester (uat-worker-plan-lifecycle) ### What Was Tested The JSON output format of `agents plan tree <PLAN_ID> --format json`. ### Expected Behavior (from spec §agents plan tree) The spec requires a structured JSON envelope with decision tree data: ```json { "command": "plan tree", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "tree": { "type": "prompt_definition", "description": "Increase test coverage to 85%", "children": [...] }, "summary": { "nodes": 9, "depth": 3, "child_plans": "2+", "invariants": 2, "superseded": 0 }, "child_plans": [ { "id": "01HXM9F1A", "phase": "execute", "state": "processing" }, { "id": "01HXM9F2B", "phase": "execute", "state": "queued" } ], "decision_ids": { "root": "01HXM9A0B1Q2W3R5G8Z0P4Q1X8", ... } }, "timing": { "started": "2026-02-08T12:58:00Z", "duration_ms": 85 }, "messages": ["Decision tree rendered"] } ``` ### Actual Behavior (from code analysis) The `tree_decisions_cmd` command at `src/cleveragents/cli/commands/plan.py` line 4029-4030 outputs the raw tree list when `fmt in (OutputFormat.JSON, OutputFormat.YAML)`: ```python if fmt in (OutputFormat.JSON, OutputFormat.YAML): console.print(format_output(tree_data, fmt)) ``` This outputs a raw list of tree nodes without the required envelope. Missing fields: - `command`, `status`, `exit_code`, `timing`, `messages` envelope - `data.plan_id` (the plan ID being queried) - `data.tree` (the tree is output directly, not nested under `data.tree`) - `data.summary` (nodes count, depth, child_plans count, invariants, superseded count) - `data.child_plans` (list of child plan IDs with their phase/state) - `data.decision_ids` (named map of key decision IDs) ### Code Location - `src/cleveragents/cli/commands/plan.py`, lines 4029-4030 (`tree_decisions_cmd` function) ### Steps to Reproduce ```bash agents plan tree <PLAN_ID> --format json ``` ### Impact Any tooling or scripts that parse `agents plan tree --format json` output will fail. The `summary` and `child_plans` fields are particularly important for understanding plan complexity and tracking child plan execution. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 00:53:17 +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#4976
No description provided.