UAT: agents plan list JSON/YAML output format mismatch — outputs flat plan list instead of spec-required {plans, filters, summary} envelope structure #3681

Open
opened 2026-04-05 21:31:38 +00:00 by freemo · 0 comments
Owner

Background and Context

The agents plan list command's JSON and YAML output formats do not match the specification (docs/specification.md lines 12179–12244). The implementation outputs a flat list of full plan spec dicts wrapped in the standard envelope's data field, but the spec requires the data field to contain a structured object with plans, filters, and summary keys.

Current Behavior

The implementation at src/cleveragents/cli/commands/plan.py lines 2449–2453:

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

This outputs the full plan spec dict for each plan (with many extra fields like plan_id, namespaced_name, phase, processing_state, state, project_links, arguments, automation_profile, action_name, description, definition_of_done, etc.) wrapped in the envelope as data: [...] — a flat list of full plan objects, not the spec-required {plans: [...], filters: {...}, summary: {...}} structure.

Actual output:

{
  "command": "plan list",
  "status": "ok",
  "exit_code": 0,
  "data": [
    {
      "plan_id": "...",
      "namespaced_name": "...",
      "phase": "...",
      "processing_state": "...",
      "state": "...",
      "project_links": "...",
      "arguments": "...",
      "automation_profile": "...",
      "action_name": "...",
      "description": "...",
      "definition_of_done": "..."
    }
  ]
}

Expected Behavior

Per spec lines 12179–12244, the data field must be a structured object with plans, filters, and summary keys:

{
  "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": "2026-02-09T14:30:00Z", "duration_ms": 95 },
  "messages": ["1 plan listed"]
}

Each plan entry in data.plans must contain only id, phase, state, action, project, elapsed fields — not the full plan spec dict.

Root Cause

lifecycle_list_plans() in plan.py (lines 2449–2453) passes a list of full plan spec dicts to format_output() instead of building the spec-required structured data object with plans, filters, and summary keys.

Affected Code

  • src/cleveragents/cli/commands/plan.pylifecycle_list_plans() (lines 2449–2453)

Steps to Reproduce

  1. Create one or more plans
  2. Run agents plan list --format json
  3. Observe that output is {"command": "plan list", ..., "data": [{plan_id: ..., namespaced_name: ..., ...}]} instead of {"command": "plan list", ..., "data": {"plans": [...], "filters": {...}, "summary": {...}}}

Metadata

  • Branch: fix/plan-list-json-yaml-output-envelope-structure
  • Commit Message: fix(plan): build spec-required {plans,filters,summary} envelope in plan list JSON/YAML output
  • Milestone: (none — backlog)
  • Parent Epic: #394

Subtasks

  • Build a structured data dict with plans (list of {id, phase, state, action, project, elapsed} per plan), filters (active filter values), and summary ({total, processing, completed, errored, cancelled}) in lifecycle_list_plans()
  • Pass this structured dict (not the raw plan list) to format_output() for JSON/YAML/plain/table formats
  • Add/update Behave unit tests in features/ covering JSON and YAML output format for plan list, asserting the plans, filters, and summary keys
  • Add/update Robot Framework integration tests in robot/ for agents plan list --format json verifying spec-compliant output
  • Verify nox -e typecheck passes
  • Verify nox -e coverage_report >= 97%
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • agents plan list --format json outputs the full standard command envelope with data.plans, data.filters, and data.summary exactly as specified in spec lines 12179–12244
  • Each plan entry in data.plans contains only id, phase, state, action, project, elapsed fields
  • data.filters contains the active filter values (null when not set)
  • data.summary contains total, processing, completed, errored, cancelled counts
  • All subtasks above are completed and checked off
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done
  • All nox stages pass
  • Coverage >= 97%

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.


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

## Background and Context The `agents plan list` command's JSON and YAML output formats do not match the specification (`docs/specification.md` lines 12179–12244). The implementation outputs a flat list of full plan spec dicts wrapped in the standard envelope's `data` field, but the spec requires the `data` field to contain a structured object with `plans`, `filters`, and `summary` keys. ## Current Behavior The implementation at `src/cleveragents/cli/commands/plan.py` lines 2449–2453: ```python if fmt != OutputFormat.RICH.value: data = [_plan_spec_dict(p) for p in plans] console.print(format_output(data, fmt)) return ``` This outputs the full plan spec dict for each plan (with many extra fields like `plan_id`, `namespaced_name`, `phase`, `processing_state`, `state`, `project_links`, `arguments`, `automation_profile`, `action_name`, `description`, `definition_of_done`, etc.) wrapped in the envelope as `data: [...]` — a flat list of full plan objects, not the spec-required `{plans: [...], filters: {...}, summary: {...}}` structure. **Actual output:** ```json { "command": "plan list", "status": "ok", "exit_code": 0, "data": [ { "plan_id": "...", "namespaced_name": "...", "phase": "...", "processing_state": "...", "state": "...", "project_links": "...", "arguments": "...", "automation_profile": "...", "action_name": "...", "description": "...", "definition_of_done": "..." } ] } ``` ## Expected Behavior Per spec lines 12179–12244, the `data` field must be a structured object with `plans`, `filters`, and `summary` keys: ```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": "2026-02-09T14:30:00Z", "duration_ms": 95 }, "messages": ["1 plan listed"] } ``` Each plan entry in `data.plans` must contain only `id`, `phase`, `state`, `action`, `project`, `elapsed` fields — not the full plan spec dict. ## Root Cause `lifecycle_list_plans()` in `plan.py` (lines 2449–2453) passes a list of full plan spec dicts to `format_output()` instead of building the spec-required structured data object with `plans`, `filters`, and `summary` keys. ## Affected Code - `src/cleveragents/cli/commands/plan.py` — `lifecycle_list_plans()` (lines 2449–2453) ## Steps to Reproduce 1. Create one or more plans 2. Run `agents plan list --format json` 3. Observe that output is `{"command": "plan list", ..., "data": [{plan_id: ..., namespaced_name: ..., ...}]}` instead of `{"command": "plan list", ..., "data": {"plans": [...], "filters": {...}, "summary": {...}}}` --- ## Metadata - **Branch**: `fix/plan-list-json-yaml-output-envelope-structure` - **Commit Message**: `fix(plan): build spec-required {plans,filters,summary} envelope in plan list JSON/YAML output` - **Milestone**: *(none — backlog)* - **Parent Epic**: #394 --- ## Subtasks - [ ] Build a structured data dict with `plans` (list of `{id, phase, state, action, project, elapsed}` per plan), `filters` (active filter values), and `summary` (`{total, processing, completed, errored, cancelled}`) in `lifecycle_list_plans()` - [ ] Pass this structured dict (not the raw plan list) to `format_output()` for JSON/YAML/plain/table formats - [ ] Add/update Behave unit tests in `features/` covering JSON and YAML output format for `plan list`, asserting the `plans`, `filters`, and `summary` keys - [ ] Add/update Robot Framework integration tests in `robot/` for `agents plan list --format json` verifying spec-compliant output - [ ] Verify `nox -e typecheck` passes - [ ] Verify `nox -e coverage_report` >= 97% - [ ] Run `nox` (all default sessions), fix any errors --- ## Definition of Done This issue is complete when: - `agents plan list --format json` outputs the full standard command envelope with `data.plans`, `data.filters`, and `data.summary` exactly as specified in spec lines 12179–12244 - Each plan entry in `data.plans` contains only `id`, `phase`, `state`, `action`, `project`, `elapsed` fields - `data.filters` contains the active filter values (null when not set) - `data.summary` contains `total`, `processing`, `completed`, `errored`, `cancelled` counts - All subtasks above are completed and checked off - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done - All nox stages pass - Coverage >= 97% > **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. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-05 21:36:43 +00:00
freemo removed this from the v3.7.0 milestone 2026-04-06 23:31:30 +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.

Blocks
#394 Epic: Decision Framework
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3681
No description provided.