UAT: agents plan use --format json output missing spec envelope and next_steps/actors/context sections #5044

Closed
opened 2026-04-09 00:50:31 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Plan Lifecycle — agents plan use

Summary

agents plan use <ACTION> <PROJECT> --format json returns a raw plan data dict instead of the spec-required JSON envelope. The output is missing the command, status, exit_code, timing, and messages top-level fields, and the data section is missing spec-required fields like attempt, inputs, actors, automation, context, and next_steps.

Expected Behavior (from spec)

Per docs/specification.md §agents plan use, the JSON output must be:

{
  "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

In src/cleveragents/cli/commands/plan.py, the use_action command (lines 1598–1935) calls _plan_spec_dict(plan) and passes it directly to format_output. This produces:

  1. No top-level envelope: No command, status, exit_code, timing, messages fields
  2. Wrong field names: action_name instead of action, project_links (list) instead of project (string), automation_profile (object) instead of automation_profile (string)
  3. Missing attempt: Not included in _plan_spec_dict output
  4. Missing inputs section: The arguments passed to the plan are not included in the spec-required inputs format
  5. Missing actors section: Strategy, execution, and estimation actors not grouped under actors
  6. Missing automation section: No profile, source, read_only breakdown
  7. Missing context section: No resource count, indexed files, view, or hot token budget
  8. Missing next_steps array: The spec requires next-step CLI commands to be included in the JSON output

The next_steps omission is particularly impactful: the spec explicitly shows that plan use JSON output should include the exact CLI commands to run next (plan execute, plan status, plan tree), enabling programmatic workflows to chain commands.

Code Location

src/cleveragents/cli/commands/plan.py:

  • use_action function (lines 1598–1935)
  • _plan_spec_dict function (lines 223–300)

Impact

Programmatic consumers of agents plan use --format json cannot discover the plan ID and next steps in a structured way. CI/CD pipelines that parse the output to chain plan execute will fail.


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

## Bug Report **Feature Area:** Plan Lifecycle — `agents plan use` ### Summary `agents plan use <ACTION> <PROJECT> --format json` returns a raw plan data dict instead of the spec-required JSON envelope. The output is missing the `command`, `status`, `exit_code`, `timing`, and `messages` top-level fields, and the `data` section is missing spec-required fields like `attempt`, `inputs`, `actors`, `automation`, `context`, and `next_steps`. ### Expected Behavior (from spec) Per `docs/specification.md` §agents plan use, the JSON output must be: ```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 In `src/cleveragents/cli/commands/plan.py`, the `use_action` command (lines 1598–1935) calls `_plan_spec_dict(plan)` and passes it directly to `format_output`. This produces: 1. **No top-level envelope**: No `command`, `status`, `exit_code`, `timing`, `messages` fields 2. **Wrong field names**: `action_name` instead of `action`, `project_links` (list) instead of `project` (string), `automation_profile` (object) instead of `automation_profile` (string) 3. **Missing `attempt`**: Not included in `_plan_spec_dict` output 4. **Missing `inputs` section**: The arguments passed to the plan are not included in the spec-required `inputs` format 5. **Missing `actors` section**: Strategy, execution, and estimation actors not grouped under `actors` 6. **Missing `automation` section**: No `profile`, `source`, `read_only` breakdown 7. **Missing `context` section**: No resource count, indexed files, view, or hot token budget 8. **Missing `next_steps` array**: The spec requires next-step CLI commands to be included in the JSON output The `next_steps` omission is particularly impactful: the spec explicitly shows that `plan use` JSON output should include the exact CLI commands to run next (`plan execute`, `plan status`, `plan tree`), enabling programmatic workflows to chain commands. ### Code Location `src/cleveragents/cli/commands/plan.py`: - `use_action` function (lines 1598–1935) - `_plan_spec_dict` function (lines 223–300) ### Impact Programmatic consumers of `agents plan use --format json` cannot discover the plan ID and next steps in a structured way. CI/CD pipelines that parse the output to chain `plan execute` will fail. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Closing as duplicate of #4969 — both issues report the same problem: agents plan use --format json output missing spec-required envelope.


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

Closing as duplicate of #4969 — both issues report the same problem: `agents plan use --format json` output missing spec-required envelope. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#5044
No description provided.