UAT: agents plan use --format json does not produce spec-required JSON envelope #4969

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

Bug Report

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

What Was Tested

The JSON output format of agents plan use <action> <project> --format json.

Expected Behavior (from spec §agents plan use)

The spec requires a structured JSON envelope with rich plan creation metadata:

{
  "command": "plan use",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "phase": "strategize",
    "action": "local/code-coverage",
    "project": "local/api-service",
    "automation_profile": "trusted",
    "attempt": 1,
    "inputs": {
      "target_coverage_percent": 85,
      "automation_profile": "trusted"
    },
    "actors": {
      "strategy": "local/strategist",
      "execution": "local/executor",
      "estimation": null
    },
    "automation": {
      "profile": "trusted",
      "source": "CLI flag",
      "read_only": false
    },
    "context": {
      "resources": 2,
      "indexed_files": 347,
      "view": "strategize",
      "hot_token_budget": 12000
    },
    "next_steps": [
      "agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J",
      "agents plan status 01HXM8C2ZK4Q7C2B3F2R4VYV6J",
      "agents plan tree 01HXM8C2ZK4Q7C2B3F2R4VYV6J"
    ]
  },
  "timing": { "started": "2026-02-09T14:30:00Z", "duration_ms": 95 },
  "messages": ["Plan created"]
}

Actual Behavior (from code analysis)

The use_action command at src/cleveragents/cli/commands/plan.py line 1911-1913 outputs _plan_spec_dict(plan) when fmt != "rich":

data = _plan_spec_dict(plan)
console.print(format_output(data, fmt))

_plan_spec_dict() returns a verbose internal plan representation with different field names (plan_id, namespaced_name, processing_state, etc.) and is missing the spec-required fields:

  • data.action (uses action_name instead)
  • data.project (uses project_links list instead)
  • data.attempt (missing)
  • data.inputs (missing — should contain the arguments passed)
  • data.actors (missing — should contain strategy/execution/estimation actors)
  • data.automation (missing — should contain profile, source, read_only)
  • data.context (missing — should contain resources, indexed_files, view, hot_token_budget)
  • data.next_steps (missing — should contain suggested next commands)
  • command, status, exit_code, timing, messages envelope (missing)

Code Location

  • src/cleveragents/cli/commands/plan.py, lines 1911-1913 (use_action function)

Steps to Reproduce

agents action create --config ./my-action.yaml
agents plan use local/my-action local/my-project --format json

Impact

Any tooling or scripts that parse agents plan use --format json output will fail because the output structure does not match the spec. The next_steps field is particularly important for automated workflows that chain plan commands.


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

## Bug Report **Feature Area**: Plan Lifecycle — `agents plan use` **Severity**: High **Discovered by**: UAT tester (uat-worker-plan-lifecycle) ### What Was Tested The JSON output format of `agents plan use <action> <project> --format json`. ### Expected Behavior (from spec §agents plan use) The spec requires a structured JSON envelope with rich plan creation metadata: ```json { "command": "plan use", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "phase": "strategize", "action": "local/code-coverage", "project": "local/api-service", "automation_profile": "trusted", "attempt": 1, "inputs": { "target_coverage_percent": 85, "automation_profile": "trusted" }, "actors": { "strategy": "local/strategist", "execution": "local/executor", "estimation": null }, "automation": { "profile": "trusted", "source": "CLI flag", "read_only": false }, "context": { "resources": 2, "indexed_files": 347, "view": "strategize", "hot_token_budget": 12000 }, "next_steps": [ "agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J", "agents plan status 01HXM8C2ZK4Q7C2B3F2R4VYV6J", "agents plan tree 01HXM8C2ZK4Q7C2B3F2R4VYV6J" ] }, "timing": { "started": "2026-02-09T14:30:00Z", "duration_ms": 95 }, "messages": ["Plan created"] } ``` ### Actual Behavior (from code analysis) The `use_action` command at `src/cleveragents/cli/commands/plan.py` line 1911-1913 outputs `_plan_spec_dict(plan)` when `fmt != "rich"`: ```python data = _plan_spec_dict(plan) console.print(format_output(data, fmt)) ``` `_plan_spec_dict()` returns a verbose internal plan representation with different field names (`plan_id`, `namespaced_name`, `processing_state`, etc.) and is missing the spec-required fields: - `data.action` (uses `action_name` instead) - `data.project` (uses `project_links` list instead) - `data.attempt` (missing) - `data.inputs` (missing — should contain the arguments passed) - `data.actors` (missing — should contain strategy/execution/estimation actors) - `data.automation` (missing — should contain profile, source, read_only) - `data.context` (missing — should contain resources, indexed_files, view, hot_token_budget) - `data.next_steps` (missing — should contain suggested next commands) - `command`, `status`, `exit_code`, `timing`, `messages` envelope (missing) ### Code Location - `src/cleveragents/cli/commands/plan.py`, lines 1911-1913 (`use_action` function) ### Steps to Reproduce ```bash agents action create --config ./my-action.yaml agents plan use local/my-action local/my-project --format json ``` ### Impact Any tooling or scripts that parse `agents plan use --format json` output will fail because the output structure does not match the spec. The `next_steps` field is particularly important for automated workflows that chain plan commands. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 00:53:19 +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#4969
No description provided.