UAT: agents plan list JSON output missing spec-required filters and summary objects, and plans key wrapper #3812

Open
opened 2026-04-06 06:32:44 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/plan-list-json-output-format
  • Commit Message: fix(cli): use spec-required output structure for agents plan list non-rich output formats
  • Milestone: Backlog (see note below)
  • Parent Epic: #397

Backlog note: This issue was discovered during autonomous operation
on milestone v3.3.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Bug Description

The agents plan list command uses [_plan_spec_dict(p) for p in plans] for non-rich output formats (JSON, YAML), but the specification requires a structured output with plans array, filters object, and summary object.

Expected Behavior (from spec §agents plan list)

The JSON output must follow this structure:

{
  "command": "plan list",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plans": [
      {
        "id": "01HXM7A9",
        "phase": "execute",
        "state": "processing",
        "action": "local/code-coverage",
        "project": "local/api-service",
        "elapsed": "00:01:12"
      }
    ],
    "filters": {
      "phase": "execute",
      "state": null,
      "project": null,
      "action": null
    },
    "summary": {
      "total": 1,
      "processing": 1,
      "completed": 0,
      "errored": 0
    }
  },
  "timing": {"started": "...", "duration_ms": 95},
  "messages": ["1 plan listed"]
}

Actual Behavior

The command passes a list of plan model dicts to format_output, producing:

{
  "command": "",
  "status": "ok",
  "exit_code": 0,
  "data": [
    {
      "plan_id": "...",
      "namespaced_name": "...",
      "phase": "execute",
      "processing_state": "processing",
      "state": "processing",
      "project_links": [...],
      "arguments": {},
      "automation_profile": "...",
      "action_name": "...",
      ...
    }
  ],
  ...
}

Key issues:

  1. "command" is empty string (no command parameter passed to format_output)
  2. data is a flat list instead of {"plans": [...], "filters": {...}, "summary": {...}}
  3. Each plan entry uses plan model fields (plan_id, namespaced_name, processing_state) instead of spec-required fields (id, phase, state, action, project, elapsed)
  4. filters object is missing
  5. summary object is missing
  6. messages doesn't include the count ("N plan(s) listed")

Code Location

src/cleveragents/cli/commands/plan.py lines ~2656-2658 (in lifecycle_list_plans function):

if fmt != OutputFormat.RICH.value:
    data = [_plan_spec_dict(p) for p in plans]
    console.print(format_output(data, fmt))

Impact

  • Any tooling, scripts, or integrations that parse agents plan list --format json output will receive incorrect data
  • The spec-required filters and summary objects are absent
  • Plan IDs are full ULIDs instead of the spec-required truncated 8-char IDs
  • The command field is empty

Steps to Reproduce

  1. Create one or more plans
  2. Run agents plan list --format json
  3. Observe output uses flat plan model list instead of spec-required structure

Subtasks

  • Create a helper function _list_output_dict(plans, phase_filter, state_filter, project_filter, action_filter) that builds the spec-required structure
  • Replace the current format_output call with the new helper
  • Pass command="plan list" to format_output
  • Include filters and summary objects in the output
  • Add BDD test verifying the JSON output structure matches the spec
  • Verify YAML format also matches spec

Definition of Done

  • agents plan list --format json output matches spec §agents plan list JSON example
  • agents plan list --format yaml output matches spec §agents plan list YAML example
  • BDD tests added covering the structured JSON/YAML output
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/plan-list-json-output-format` - **Commit Message**: `fix(cli): use spec-required output structure for agents plan list non-rich output formats` - **Milestone**: Backlog (see note below) - **Parent Epic**: #397 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.3.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Bug Description The `agents plan list` command uses `[_plan_spec_dict(p) for p in plans]` for non-rich output formats (JSON, YAML), but the specification requires a structured output with `plans` array, `filters` object, and `summary` object. ### Expected Behavior (from spec §agents plan list) The JSON output must follow this structure: ```json { "command": "plan list", "status": "ok", "exit_code": 0, "data": { "plans": [ { "id": "01HXM7A9", "phase": "execute", "state": "processing", "action": "local/code-coverage", "project": "local/api-service", "elapsed": "00:01:12" } ], "filters": { "phase": "execute", "state": null, "project": null, "action": null }, "summary": { "total": 1, "processing": 1, "completed": 0, "errored": 0 } }, "timing": {"started": "...", "duration_ms": 95}, "messages": ["1 plan listed"] } ``` ### Actual Behavior The command passes a list of plan model dicts to `format_output`, producing: ```json { "command": "", "status": "ok", "exit_code": 0, "data": [ { "plan_id": "...", "namespaced_name": "...", "phase": "execute", "processing_state": "processing", "state": "processing", "project_links": [...], "arguments": {}, "automation_profile": "...", "action_name": "...", ... } ], ... } ``` Key issues: 1. `"command"` is empty string (no command parameter passed to `format_output`) 2. `data` is a flat list instead of `{"plans": [...], "filters": {...}, "summary": {...}}` 3. Each plan entry uses plan model fields (`plan_id`, `namespaced_name`, `processing_state`) instead of spec-required fields (`id`, `phase`, `state`, `action`, `project`, `elapsed`) 4. `filters` object is missing 5. `summary` object is missing 6. `messages` doesn't include the count ("N plan(s) listed") ### Code Location `src/cleveragents/cli/commands/plan.py` lines ~2656-2658 (in `lifecycle_list_plans` function): ```python if fmt != OutputFormat.RICH.value: data = [_plan_spec_dict(p) for p in plans] console.print(format_output(data, fmt)) ``` ### Impact - Any tooling, scripts, or integrations that parse `agents plan list --format json` output will receive incorrect data - The spec-required `filters` and `summary` objects are absent - Plan IDs are full ULIDs instead of the spec-required truncated 8-char IDs - The `command` field is empty ### Steps to Reproduce 1. Create one or more plans 2. Run `agents plan list --format json` 3. Observe output uses flat plan model list instead of spec-required structure ## Subtasks - [ ] Create a helper function `_list_output_dict(plans, phase_filter, state_filter, project_filter, action_filter)` that builds the spec-required structure - [ ] Replace the current `format_output` call with the new helper - [ ] Pass `command="plan list"` to `format_output` - [ ] Include `filters` and `summary` objects in the output - [ ] Add BDD test verifying the JSON output structure matches the spec - [ ] Verify YAML format also matches spec ## Definition of Done - [ ] `agents plan list --format json` output matches spec §agents plan list JSON example - [ ] `agents plan list --format yaml` output matches spec §agents plan list YAML example - [ ] BDD tests added covering the structured JSON/YAML output - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
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.

Blocks
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3812
No description provided.