UAT: agents plan tree JSON/YAML output missing spec-required envelope — returns raw array instead of structured response #5906

Open
opened 2026-04-09 11:42:23 +00:00 by HAL9000 · 0 comments
Owner

Bug Report

Feature Area: Decision Tree Rendering
Command: agents plan tree <PLAN_ID> --format json / --format yaml
Milestone: v3.2.0
Severity: Non-critical (Priority/Backlog)


What Was Tested

Code analysis of agents plan tree command JSON/YAML output path in src/cleveragents/cli/commands/plan.py (function tree_decisions_cmd, lines 4029–4030) against the specification at docs/specification.md §agents plan tree JSON example (lines 14424–14483).


Expected Behavior (from spec §14424–14483)

The JSON output of agents plan tree --format json should be a structured response envelope:

{
  "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",
      "invariant_1": "...",
      "strategy": "..."
    }
  },
  "timing": { "started": "...", "duration_ms": 85 },
  "messages": ["Decision tree rendered"]
}

The spec also defines a description field (not question) and children (not nested children with decision_id) in the tree nodes.


Actual Behavior

The current implementation (line 4029–4030) passes the raw tree_data list directly to format_output():

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

This produces a raw JSON array of tree nodes with decision_id, type, sequence, question, chosen, confidence, superseded, children fields — not the spec-required envelope with command, status, exit_code, data, timing, messages wrapper.

Additionally, the tree node fields differ from spec:

  • Implementation uses question field; spec uses description
  • Implementation includes decision_id, sequence, chosen, superseded; spec tree nodes only have type, description, confidence, children (and optionally plan_id for subplan spawns)

Steps to Reproduce

  1. Create a plan with decisions
  2. Run agents plan tree <PLAN_ID> --format json
  3. Observe: raw array [{"decision_id": "...", "type": "...", "question": "...", ...}] instead of spec envelope

Impact

Any tooling or scripts that parse agents plan tree --format json output will receive an incompatible structure compared to what the spec documents. This breaks the machine-readable interface contract.


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

## Bug Report **Feature Area:** Decision Tree Rendering **Command:** `agents plan tree <PLAN_ID> --format json` / `--format yaml` **Milestone:** v3.2.0 **Severity:** Non-critical (Priority/Backlog) --- ## What Was Tested Code analysis of `agents plan tree` command JSON/YAML output path in `src/cleveragents/cli/commands/plan.py` (function `tree_decisions_cmd`, lines 4029–4030) against the specification at `docs/specification.md` §agents plan tree JSON example (lines 14424–14483). --- ## Expected Behavior (from spec §14424–14483) The JSON output of `agents plan tree --format json` should be a **structured response envelope**: ```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", "invariant_1": "...", "strategy": "..." } }, "timing": { "started": "...", "duration_ms": 85 }, "messages": ["Decision tree rendered"] } ``` The spec also defines a `description` field (not `question`) and `children` (not nested `children` with `decision_id`) in the tree nodes. --- ## Actual Behavior The current implementation (line 4029–4030) passes the raw `tree_data` list directly to `format_output()`: ```python if fmt in (OutputFormat.JSON, OutputFormat.YAML): console.print(format_output(tree_data, fmt)) ``` This produces a **raw JSON array** of tree nodes with `decision_id`, `type`, `sequence`, `question`, `chosen`, `confidence`, `superseded`, `children` fields — not the spec-required envelope with `command`, `status`, `exit_code`, `data`, `timing`, `messages` wrapper. Additionally, the tree node fields differ from spec: - Implementation uses `question` field; spec uses `description` - Implementation includes `decision_id`, `sequence`, `chosen`, `superseded`; spec tree nodes only have `type`, `description`, `confidence`, `children` (and optionally `plan_id` for subplan spawns) --- ## Steps to Reproduce 1. Create a plan with decisions 2. Run `agents plan tree <PLAN_ID> --format json` 3. Observe: raw array `[{"decision_id": "...", "type": "...", "question": "...", ...}]` instead of spec envelope --- ## Impact Any tooling or scripts that parse `agents plan tree --format json` output will receive an incompatible structure compared to what the spec documents. This breaks the machine-readable interface contract. --- **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.

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