UAT: agents plan tree --format json output is raw tree array instead of spec-required JSON envelope with command/status/exit_code/data/timing/messages #5341

Open
opened 2026-04-09 05:54:48 +00:00 by HAL9000 · 2 comments
Owner

Bug Report

Feature Area: Plan Lifecycle — agents plan tree CLI command (JSON/YAML output)
Severity: Medium — JSON/YAML output format deviates from spec, breaking automation tools
Source: src/cleveragents/cli/commands/plan.py lines 4029–4030


What Was Tested

Code-level analysis of the tree_decisions_cmd CLI command's JSON/YAML output format.

Expected Behavior (from spec §agents plan tree, lines 14424–14483)

The spec defines a JSON output envelope:

{
  "command": "plan tree",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "tree": { ... },
    "summary": {
      "nodes": 9,
      "depth": 3,
      "child_plans": "2+",
      "invariants": 2,
      "superseded": 0
    },
    "child_plans": [...],
    "decision_ids": { ... }
  },
  "timing": {
    "started": "2026-02-08T12:58:00Z",
    "duration_ms": 85
  },
  "messages": ["Decision tree rendered"]
}

Actual Behavior

The implementation (lines 4029–4030) outputs the raw tree_data list directly:

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

This produces a bare JSON array of tree nodes without the command, status, exit_code, data, timing, or messages wrapper. The data.summary, data.child_plans, and data.decision_ids fields are also missing entirely.

Specific Deviations

  1. Missing envelope: No command, status, exit_code, timing, messages fields
  2. Missing data.summary: No nodes, depth, child_plans, invariants, superseded counts
  3. Missing data.child_plans: No child plan status table
  4. Missing data.decision_ids: No labeled decision ID map for correction use
  5. Wrong root key: Output is a bare array instead of {"data": {"tree": [...]}}

Code Location

  • src/cleveragents/cli/commands/plan.py lines 4029–4030 — JSON/YAML output branch

Steps to Reproduce

  1. Create and execute a plan to generate decisions
  2. Run agents plan tree <plan_id> --format json
  3. Observe: bare JSON array instead of spec-required envelope

Impact

  • Automation tools parsing plan tree --format json will fail to find expected fields
  • jq '.data.summary.nodes' returns null instead of the node count
  • Inconsistent with other commands that use the standard envelope format
  • #5183plan tree rich output gaps (separate issue for rich format)
  • Part of #4958 (EPIC: Decision Recording & Tree Visualization)

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

## Bug Report **Feature Area:** Plan Lifecycle — `agents plan tree` CLI command (JSON/YAML output) **Severity:** Medium — JSON/YAML output format deviates from spec, breaking automation tools **Source:** `src/cleveragents/cli/commands/plan.py` lines 4029–4030 --- ## What Was Tested Code-level analysis of the `tree_decisions_cmd` CLI command's JSON/YAML output format. ## Expected Behavior (from spec §agents plan tree, lines 14424–14483) The spec defines a JSON output envelope: ```json { "command": "plan tree", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "tree": { ... }, "summary": { "nodes": 9, "depth": 3, "child_plans": "2+", "invariants": 2, "superseded": 0 }, "child_plans": [...], "decision_ids": { ... } }, "timing": { "started": "2026-02-08T12:58:00Z", "duration_ms": 85 }, "messages": ["Decision tree rendered"] } ``` ## Actual Behavior The implementation (lines 4029–4030) outputs the raw `tree_data` list directly: ```python if fmt in (OutputFormat.JSON, OutputFormat.YAML): console.print(format_output(tree_data, fmt)) ``` This produces a bare JSON array of tree nodes without the `command`, `status`, `exit_code`, `data`, `timing`, or `messages` wrapper. The `data.summary`, `data.child_plans`, and `data.decision_ids` fields are also missing entirely. ## Specific Deviations 1. **Missing envelope**: No `command`, `status`, `exit_code`, `timing`, `messages` fields 2. **Missing `data.summary`**: No `nodes`, `depth`, `child_plans`, `invariants`, `superseded` counts 3. **Missing `data.child_plans`**: No child plan status table 4. **Missing `data.decision_ids`**: No labeled decision ID map for correction use 5. **Wrong root key**: Output is a bare array instead of `{"data": {"tree": [...]}}` ## Code Location - `src/cleveragents/cli/commands/plan.py` lines 4029–4030 — JSON/YAML output branch ## Steps to Reproduce 1. Create and execute a plan to generate decisions 2. Run `agents plan tree <plan_id> --format json` 3. Observe: bare JSON array instead of spec-required envelope ## Impact - Automation tools parsing `plan tree --format json` will fail to find expected fields - `jq '.data.summary.nodes'` returns null instead of the node count - Inconsistent with other commands that use the standard envelope format ## Related Issues - #5183 — `plan tree` rich output gaps (separate issue for rich format) - Part of #4958 (EPIC: Decision Recording & Tree Visualization) --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 06:00:58 +00:00
Author
Owner

Label compliance fix applied:

  • Assigned milestone based on issue scope
  • Reason: Issue was missing a milestone assignment per CONTRIBUTING.md requirements.

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

Label compliance fix applied: - Assigned milestone based on issue scope - Reason: Issue was missing a milestone assignment per CONTRIBUTING.md requirements. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
Author
Owner

Hierarchical Compliance Fix: Linked to Epic #4958 (Decision Recording & Tree Visualization) — this issue is part of the plan decision recording and visualization system.


Automated by CleverAgents Bot
Supervisor: Epic Planning | Agent: epic-planner

**Hierarchical Compliance Fix**: Linked to Epic #4958 (Decision Recording & Tree Visualization) — this issue is part of the plan decision recording and visualization system. --- **Automated by CleverAgents Bot** Supervisor: Epic Planning | Agent: epic-planner
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.

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