UAT: agents plan use --format json returns raw plan dict instead of spec-required output envelope — missing command, status, inputs, actors, automation, context, next_steps, timing, messages #6860

Open
opened 2026-04-10 03:41:26 +00:00 by HAL9000 · 0 comments
Owner

Background and Context

The agents plan use command is the entry point to the plan lifecycle. When called with --format json, the spec defines a precise output envelope with nested objects for inputs, actors, automation context, and next steps. This structure is consumed by scripts and CI/CD pipelines.

Current Behavior

Code at src/cleveragents/cli/commands/plan.py lines 2239–2241:

if fmt != OutputFormat.RICH.value:
    data = _plan_spec_dict(plan)
    console.print(format_output(data, fmt))

_plan_spec_dict(plan) returns the raw plan domain dict with fields like plan_id, namespaced_name, phase, processing_state, project_links, arguments, automation_profile, action_name, created_at, updated_at, etc.

This is not the spec-required output. The actual JSON output is a flat domain dump, not a spec-compliant response envelope.

Expected Behavior

Per spec §agents plan use (JSON example §12602–12644), the 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"]
}

Missing from current implementation:

  • Top-level envelope: command, status, exit_code, timing, messages
  • data.action (uses action_name instead)
  • data.project (uses project_links array instead)
  • data.attempt
  • data.inputs object (the parsed arguments with automation_profile merged in)
  • data.actors object (strategy, execution, estimation keys)
  • data.automation object (profile, source, read_only keys)
  • data.context object (resources, indexed_files, view, hot_token_budget keys)
  • data.next_steps array

Acceptance Criteria

  • agents plan use --format json returns a JSON object with top-level command, status, exit_code, data, timing, messages
  • data contains plan_id, phase, action, project, automation_profile, attempt, inputs, actors, automation, context, next_steps
  • data.actors contains strategy, execution, estimation keys
  • data.automation contains profile, source, read_only keys
  • data.next_steps is a list of suggested follow-up commands

Supporting Information

  • Spec reference: §agents plan use, JSON examples at lines 12602–12644 and 12750–12776
  • Code location: src/cleveragents/cli/commands/plan.py lines 2239–2241 (use_action command)
  • Related: _plan_spec_dict() function (lines 224–301) — this is a domain dict helper, not an output envelope builder

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

## Background and Context The `agents plan use` command is the entry point to the plan lifecycle. When called with `--format json`, the spec defines a precise output envelope with nested objects for inputs, actors, automation context, and next steps. This structure is consumed by scripts and CI/CD pipelines. ## Current Behavior Code at `src/cleveragents/cli/commands/plan.py` lines 2239–2241: ```python if fmt != OutputFormat.RICH.value: data = _plan_spec_dict(plan) console.print(format_output(data, fmt)) ``` `_plan_spec_dict(plan)` returns the raw plan domain dict with fields like `plan_id`, `namespaced_name`, `phase`, `processing_state`, `project_links`, `arguments`, `automation_profile`, `action_name`, `created_at`, `updated_at`, etc. This is **not** the spec-required output. The actual JSON output is a flat domain dump, not a spec-compliant response envelope. ## Expected Behavior Per spec §agents plan use (JSON example §12602–12644), the 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"] } ``` **Missing from current implementation:** - Top-level envelope: `command`, `status`, `exit_code`, `timing`, `messages` - `data.action` (uses `action_name` instead) - `data.project` (uses `project_links` array instead) - `data.attempt` - `data.inputs` object (the parsed arguments with automation_profile merged in) - `data.actors` object (`strategy`, `execution`, `estimation` keys) - `data.automation` object (`profile`, `source`, `read_only` keys) - `data.context` object (`resources`, `indexed_files`, `view`, `hot_token_budget` keys) - `data.next_steps` array ## Acceptance Criteria - `agents plan use --format json` returns a JSON object with top-level `command`, `status`, `exit_code`, `data`, `timing`, `messages` - `data` contains `plan_id`, `phase`, `action`, `project`, `automation_profile`, `attempt`, `inputs`, `actors`, `automation`, `context`, `next_steps` - `data.actors` contains `strategy`, `execution`, `estimation` keys - `data.automation` contains `profile`, `source`, `read_only` keys - `data.next_steps` is a list of suggested follow-up commands ## Supporting Information - Spec reference: §agents plan use, JSON examples at lines 12602–12644 and 12750–12776 - Code location: `src/cleveragents/cli/commands/plan.py` lines 2239–2241 (`use_action` command) - Related: `_plan_spec_dict()` function (lines 224–301) — this is a domain dict helper, not an output envelope builder --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.4.0 milestone 2026-04-10 03:42:10 +00:00
HAL9000 self-assigned this 2026-04-10 06:06:36 +00:00
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#6860
No description provided.