[BUG] agents plan tree --format json/yaml missing spec-required output envelope #9163

Closed
opened 2026-04-14 08:59:11 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit Message: fix(plan): wrap plan tree JSON/YAML output in spec-required command envelope
  • Branch: fix/plan-tree-json-output-envelope

Background and Context

The spec (docs/specification.md §agents plan tree, lines 14424–14544) defines the required JSON and YAML output format for agents plan tree --format json. The output must be wrapped in a standard command envelope.

Current Behavior

The tree_decisions_cmd() function in src/cleveragents/cli/commands/plan.py (line 4412) outputs the raw tree list directly, producing a bare JSON array instead of the required envelope.

Expected Behavior

Per docs/specification.md lines 14424–14483, agents plan tree --format json must return:

{
  "command": "plan tree",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "<PLAN_ID>",
    "tree": { ... },
    "summary": { "nodes": N, "depth": N, "child_plans": "N+", "invariants": N, "superseded": N },
    "child_plans": [...],
    "decision_ids": { ... }
  },
  "timing": { "started": "...", "duration_ms": N },
  "messages": ["Decision tree rendered"]
}

Note: This is related to but distinct from issue #9096. The root cause is the missing envelope wrapper.

Acceptance Criteria

  • agents plan tree <PLAN_ID> --format json returns a JSON object with command, status, exit_code, data, timing, messages keys
  • data contains plan_id, tree, summary, child_plans, decision_ids
  • agents plan tree <PLAN_ID> --format yaml returns the same structure in YAML format
  • messages contains ["Decision tree rendered"]
  • BDD tests updated to verify envelope structure

Subtasks

  • Update tree_decisions_cmd() to wrap JSON/YAML output in spec-required envelope
  • Add summary computation (nodes count, depth, child_plans count, invariants count, superseded count)
  • Add decision_ids dict to the envelope
  • Update BDD tests in features/plan_explain.feature to verify envelope structure

Definition of Done

  • agents plan tree --format json returns spec-compliant envelope
  • All BDD tests pass
  • No regressions in other plan tree tests

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `fix(plan): wrap plan tree JSON/YAML output in spec-required command envelope` - **Branch**: `fix/plan-tree-json-output-envelope` ## Background and Context The spec (`docs/specification.md` §agents plan tree, lines 14424–14544) defines the required JSON and YAML output format for `agents plan tree --format json`. The output must be wrapped in a standard command envelope. ## Current Behavior The `tree_decisions_cmd()` function in `src/cleveragents/cli/commands/plan.py` (line 4412) outputs the raw tree list directly, producing a bare JSON array instead of the required envelope. ## Expected Behavior Per `docs/specification.md` lines 14424–14483, `agents plan tree --format json` must return: ```json { "command": "plan tree", "status": "ok", "exit_code": 0, "data": { "plan_id": "<PLAN_ID>", "tree": { ... }, "summary": { "nodes": N, "depth": N, "child_plans": "N+", "invariants": N, "superseded": N }, "child_plans": [...], "decision_ids": { ... } }, "timing": { "started": "...", "duration_ms": N }, "messages": ["Decision tree rendered"] } ``` **Note**: This is related to but distinct from issue #9096. The root cause is the missing envelope wrapper. ## Acceptance Criteria - [ ] `agents plan tree <PLAN_ID> --format json` returns a JSON object with `command`, `status`, `exit_code`, `data`, `timing`, `messages` keys - [ ] `data` contains `plan_id`, `tree`, `summary`, `child_plans`, `decision_ids` - [ ] `agents plan tree <PLAN_ID> --format yaml` returns the same structure in YAML format - [ ] `messages` contains `["Decision tree rendered"]` - [ ] BDD tests updated to verify envelope structure ## Subtasks - [ ] Update `tree_decisions_cmd()` to wrap JSON/YAML output in spec-required envelope - [ ] Add `summary` computation (nodes count, depth, child_plans count, invariants count, superseded count) - [ ] Add `decision_ids` dict to the envelope - [ ] Update BDD tests in `features/plan_explain.feature` to verify envelope structure ## Definition of Done - `agents plan tree --format json` returns spec-compliant envelope - All BDD tests pass - No regressions in other plan tree tests --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
HAL9000 added this to the v3.2.0 milestone 2026-04-14 09:03:05 +00:00
Author
Owner

Triage: Verified [AUTO-OWNR-1]

Valid bug: agents plan tree --format json/yaml is missing the spec-required output envelope. This is a spec compliance issue affecting machine-readable output.

Assigning to v3.2.0 as plan tree is a core M3 deliverable. Priority Medium — affects machine-readable output format.

MoSCoW: Should Have — consistent output envelopes are important for tooling integration.


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

✅ **Triage: Verified** [AUTO-OWNR-1] Valid bug: `agents plan tree --format json/yaml` is missing the spec-required output envelope. This is a spec compliance issue affecting machine-readable output. Assigning to **v3.2.0** as `plan tree` is a core M3 deliverable. Priority **Medium** — affects machine-readable output format. MoSCoW: **Should Have** — consistent output envelopes are important for tooling integration. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor
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#9163
No description provided.