UAT: agents plan artifacts JSON/YAML output format completely wrong — uses changeset fields instead of spec-required artifacts/summary/by_plan structure #3642

Open
opened 2026-04-05 21:02:54 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/plan-artifacts-json-yaml-output-format
  • Commit Message: fix(cli): correct plan artifacts JSON/YAML output to match spec envelope structure
  • Milestone: (none — backlog)
  • Parent Epic: #394

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.

Description

The agents plan artifacts <PLAN_ID> command's JSON/YAML output format does not match the specification (spec lines 15749–15824). The implementation outputs changeset-level metadata instead of the spec-required artifact-centric structure wrapped in the standard command envelope.

Expected behavior (per spec lines 15749–15824)

{
  "command": "plan artifacts",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "artifacts": [
      { "path": "src/auth/session.py", "type": "write", "size": "2.1 KB", "change": "+8 -2", "child_plan": "root" },
      { "path": "tests/test_session.py", "type": "write", "size": "4.7 KB", "change": "+47 -0", "child_plan": "root" }
    ],
    "summary": {
      "total": 4,
      "writes": 2,
      "edits": 2,
      "deletes": 0,
      "total_size": "11.8 KB"
    },
    "by_plan": {
      "root": 3,
      "auth-tests": 1
    }
  },
  "timing": { "started": "...", "duration_ms": 480 },
  "messages": ["4 artifacts listed"]
}

Actual behavior (_build_artifacts_dict() in plan_apply_service.py, lines 211–243)

{
  "plan_id": "...",
  "phase": "...",
  "processing_state": "...",
  "changeset_id": "...",
  "sandbox_refs": [...],
  "changeset_summary": {...},
  "files_changed": [{"path": "...", "operation": "..."}]
}

Root cause

_build_artifacts_dict() in plan_apply_service.py was designed to output changeset metadata, not the spec-required artifact-centric structure. The function needs to be rewritten to:

  1. Wrap output in the standard command envelope (command, status, exit_code, data, timing, messages)
  2. Output artifacts array with path, type, size, change, child_plan fields per artifact
  3. Output summary with total, writes, edits, deletes, total_size
  4. Output by_plan grouping artifacts by child plan name

Affected code

  • src/cleveragents/application/services/plan_apply_service.py_build_artifacts_dict() (lines 211–243) and artifacts() method (lines 330–353)
  • src/cleveragents/cli/commands/plan.pyplan_artifacts() command (lines 2764–2794)

Steps to reproduce

  1. Create a plan and execute it
  2. Run agents plan artifacts <PLAN_ID> --format json
  3. Observe that output is {plan_id, phase, processing_state, changeset_id, ...} instead of {command, status, exit_code, data: {artifacts, summary, by_plan}, timing, messages}

Subtasks

  • Rewrite _build_artifacts_dict() in plan_apply_service.py to return the spec-required artifact-centric structure with artifacts, summary, and by_plan keys
  • Wrap the return value in the standard command envelope (command, status, exit_code, data, timing, messages)
  • Update artifacts() method in plan_apply_service.py (lines 330–353) to use the rewritten builder
  • Update plan_artifacts() CLI command in plan.py (lines 2764–2794) to pass through the envelope correctly for both JSON and YAML output formats
  • Tests (Behave): Add/update scenarios in features/ covering JSON and YAML output format for plan artifacts, asserting all envelope fields and nested artifacts, summary, by_plan structure
  • Tests (Robot): Add/update integration test in robot/ for agents plan artifacts --format json and --format yaml verifying spec-compliant output
  • Verify coverage >=97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • agents plan artifacts <PLAN_ID> --format json outputs the full standard command envelope with command, status, exit_code, data (containing artifacts, summary, by_plan), timing, and messages fields exactly as specified in spec lines 15749–15824.
  • agents plan artifacts <PLAN_ID> --format yaml outputs the equivalent YAML structure.
  • Each artifact entry contains path, type, size, change, and child_plan fields.
  • The summary block contains total, writes, edits, deletes, and total_size.
  • The by_plan block groups artifact counts by child plan name.
  • 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%

Automated by CleverAgents Bot
Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/plan-artifacts-json-yaml-output-format` - **Commit Message**: `fix(cli): correct plan artifacts JSON/YAML output to match spec envelope structure` - **Milestone**: *(none — backlog)* - **Parent Epic**: #394 > **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. ## Description The `agents plan artifacts <PLAN_ID>` command's JSON/YAML output format does not match the specification (spec lines 15749–15824). The implementation outputs changeset-level metadata instead of the spec-required artifact-centric structure wrapped in the standard command envelope. ### Expected behavior (per spec lines 15749–15824) ```json { "command": "plan artifacts", "status": "ok", "exit_code": 0, "data": { "artifacts": [ { "path": "src/auth/session.py", "type": "write", "size": "2.1 KB", "change": "+8 -2", "child_plan": "root" }, { "path": "tests/test_session.py", "type": "write", "size": "4.7 KB", "change": "+47 -0", "child_plan": "root" } ], "summary": { "total": 4, "writes": 2, "edits": 2, "deletes": 0, "total_size": "11.8 KB" }, "by_plan": { "root": 3, "auth-tests": 1 } }, "timing": { "started": "...", "duration_ms": 480 }, "messages": ["4 artifacts listed"] } ``` ### Actual behavior (`_build_artifacts_dict()` in `plan_apply_service.py`, lines 211–243) ```json { "plan_id": "...", "phase": "...", "processing_state": "...", "changeset_id": "...", "sandbox_refs": [...], "changeset_summary": {...}, "files_changed": [{"path": "...", "operation": "..."}] } ``` ### Root cause `_build_artifacts_dict()` in `plan_apply_service.py` was designed to output changeset metadata, not the spec-required artifact-centric structure. The function needs to be rewritten to: 1. Wrap output in the standard command envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`) 2. Output `artifacts` array with `path`, `type`, `size`, `change`, `child_plan` fields per artifact 3. Output `summary` with `total`, `writes`, `edits`, `deletes`, `total_size` 4. Output `by_plan` grouping artifacts by child plan name ### Affected code - `src/cleveragents/application/services/plan_apply_service.py` — `_build_artifacts_dict()` (lines 211–243) and `artifacts()` method (lines 330–353) - `src/cleveragents/cli/commands/plan.py` — `plan_artifacts()` command (lines 2764–2794) ### Steps to reproduce 1. Create a plan and execute it 2. Run `agents plan artifacts <PLAN_ID> --format json` 3. Observe that output is `{plan_id, phase, processing_state, changeset_id, ...}` instead of `{command, status, exit_code, data: {artifacts, summary, by_plan}, timing, messages}` ## Subtasks - [ ] Rewrite `_build_artifacts_dict()` in `plan_apply_service.py` to return the spec-required artifact-centric structure with `artifacts`, `summary`, and `by_plan` keys - [ ] Wrap the return value in the standard command envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`) - [ ] Update `artifacts()` method in `plan_apply_service.py` (lines 330–353) to use the rewritten builder - [ ] Update `plan_artifacts()` CLI command in `plan.py` (lines 2764–2794) to pass through the envelope correctly for both JSON and YAML output formats - [ ] Tests (Behave): Add/update scenarios in `features/` covering JSON and YAML output format for `plan artifacts`, asserting all envelope fields and nested `artifacts`, `summary`, `by_plan` structure - [ ] Tests (Robot): Add/update integration test in `robot/` for `agents plan artifacts --format json` and `--format yaml` verifying spec-compliant output - [ ] Verify coverage >=97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `agents plan artifacts <PLAN_ID> --format json` outputs the full standard command envelope with `command`, `status`, `exit_code`, `data` (containing `artifacts`, `summary`, `by_plan`), `timing`, and `messages` fields exactly as specified in spec lines 15749–15824. - `agents plan artifacts <PLAN_ID> --format yaml` outputs the equivalent YAML structure. - Each artifact entry contains `path`, `type`, `size`, `change`, and `child_plan` fields. - The `summary` block contains `total`, `writes`, `edits`, `deletes`, and `total_size`. - The `by_plan` block groups artifact counts by child plan name. - 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% --- **Automated by CleverAgents Bot** Supervisor: Acting on behalf of: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Backlog — JSON/YAML output format deviation from spec. The command works but outputs the wrong structure.
  • Story Points: 5 — L — Requires rewriting _build_artifacts_dict(), implementing the standard command envelope, updating CLI handler, and comprehensive test coverage for both JSON and YAML formats.
  • MoSCoW: Could Have — The plan artifacts command works and provides useful information, just in a different format than the spec requires. This is output format polish that doesn't block core functionality.
  • Parent Epic: #394

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: ca-project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Backlog — JSON/YAML output format deviation from spec. The command works but outputs the wrong structure. - **Story Points**: 5 — L — Requires rewriting `_build_artifacts_dict()`, implementing the standard command envelope, updating CLI handler, and comprehensive test coverage for both JSON and YAML formats. - **MoSCoW**: Could Have — The plan artifacts command works and provides useful information, just in a different format than the spec requires. This is output format polish that doesn't block core functionality. - **Parent Epic**: #394 --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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#3642
No description provided.