UAT: agents plan execute --format json output doesn't match spec — missing sandbox, progress, worker, strategy_summary fields #3435

Closed
opened 2026-04-05 16:49:37 +00:00 by freemo · 3 comments
Owner

Metadata

  • Branch: bugfix/m3-plan-execute-json-output-spec
  • Commit Message: fix(cli): build spec-required execute output dict with sandbox, worker, progress fields in plan execute
  • Milestone: v3.2.0
  • Parent Epic: #933

Background and Context

The agents plan execute --format json command outputs a raw plan state dict (phase, processing_state, project_links, etc.) but the spec requires a completely different structure focused on execution status, sandbox details, worker info, and progress steps.

Expected Behavior (from spec):

{
  "command": "agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
    "phase": "execute",
    "sandbox": {
      "strategy": "git_worktree",
      "path": "/repos/api/.worktrees/plan-01HXM8",
      "branch": "cleveragents/plan-01HXM8C2",
      "status": "active"
    },
    "worker": "local/executor",
    "started": "12:58:10",
    "attempt": 1,
    "strategy_summary": {
      "decisions": 8,
      "invariants": 2,
      "planned_child_plans": "2+",
      "estimated_files": 12,
      "risk": "low"
    },
    "progress": [
      { "label": "Collect context", "status": "running" },
      { "label": "Run tools", "status": "pending" },
      { "label": "Build changeset", "status": "pending" },
      { "label": "Validate", "status": "pending" }
    ]
  },
  "timing": { "duration_ms": 1234 },
  "messages": [{ "level": "ok", "text": "Plan execution started" }]
}

Actual Behavior:
agents plan execute --format json outputs the raw plan domain model dict via _plan_spec_dict():

{
  "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J",
  "namespaced_name": "local/my-plan",
  "phase": "execute",
  "processing_state": "complete",
  "state": "complete",
  "project_links": [...],
  "arguments": {},
  "automation_profile": null,
  "action_name": "local/my-action",
  ...
}

The output is missing: sandbox, worker, started, attempt, strategy_summary, progress fields. The output also lacks the spec-required envelope (command, status, exit_code, data, timing, messages).

Code Location:

  • src/cleveragents/cli/commands/plan.py, line 1899–1901 — execute_plan() — calls format_output(_plan_spec_dict(plan), fmt) which returns wrong structure
  • src/cleveragents/cli/commands/plan.py, line 187 — _plan_spec_dict() — returns plan domain model dict, not execute-specific output

Steps to Reproduce:

  1. Create a plan: agents plan use local/my-action --project local/proj
  2. Execute: agents plan execute <PLAN_ID> --format json
  3. Observe: raw plan state dict without sandbox/progress/worker fields

Subtasks

  • Create _execute_output_dict(plan, executor_result) function that builds the spec-required execute output structure
  • Add sandbox info (strategy, path, branch, status) to execute output
  • Add worker, started, attempt, strategy_summary, progress fields
  • Wrap in spec-required JSON envelope (command, status, exit_code, data, timing, messages)
  • Update execute_plan() to use new output function when fmt != "rich"
  • Add BDD unit tests for plan execute --format json output structure
  • Verify nox -e typecheck passes
  • Verify coverage >= 97%

Definition of Done

  • agents plan execute --format json outputs the spec-required structure with sandbox, worker, progress fields
  • 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 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: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `bugfix/m3-plan-execute-json-output-spec` - **Commit Message**: `fix(cli): build spec-required execute output dict with sandbox, worker, progress fields in plan execute` - **Milestone**: v3.2.0 - **Parent Epic**: #933 ## Background and Context The `agents plan execute --format json` command outputs a raw plan state dict (phase, processing_state, project_links, etc.) but the spec requires a completely different structure focused on execution status, sandbox details, worker info, and progress steps. **Expected Behavior (from spec):** ```json { "command": "agents plan execute 01HXM8C2ZK4Q7C2B3F2R4VYV6J", "status": "ok", "exit_code": 0, "data": { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "phase": "execute", "sandbox": { "strategy": "git_worktree", "path": "/repos/api/.worktrees/plan-01HXM8", "branch": "cleveragents/plan-01HXM8C2", "status": "active" }, "worker": "local/executor", "started": "12:58:10", "attempt": 1, "strategy_summary": { "decisions": 8, "invariants": 2, "planned_child_plans": "2+", "estimated_files": 12, "risk": "low" }, "progress": [ { "label": "Collect context", "status": "running" }, { "label": "Run tools", "status": "pending" }, { "label": "Build changeset", "status": "pending" }, { "label": "Validate", "status": "pending" } ] }, "timing": { "duration_ms": 1234 }, "messages": [{ "level": "ok", "text": "Plan execution started" }] } ``` **Actual Behavior:** `agents plan execute --format json` outputs the raw plan domain model dict via `_plan_spec_dict()`: ```json { "plan_id": "01HXM8C2ZK4Q7C2B3F2R4VYV6J", "namespaced_name": "local/my-plan", "phase": "execute", "processing_state": "complete", "state": "complete", "project_links": [...], "arguments": {}, "automation_profile": null, "action_name": "local/my-action", ... } ``` The output is missing: `sandbox`, `worker`, `started`, `attempt`, `strategy_summary`, `progress` fields. The output also lacks the spec-required envelope (`command`, `status`, `exit_code`, `data`, `timing`, `messages`). **Code Location:** - `src/cleveragents/cli/commands/plan.py`, line 1899–1901 — `execute_plan()` — calls `format_output(_plan_spec_dict(plan), fmt)` which returns wrong structure - `src/cleveragents/cli/commands/plan.py`, line 187 — `_plan_spec_dict()` — returns plan domain model dict, not execute-specific output **Steps to Reproduce:** 1. Create a plan: `agents plan use local/my-action --project local/proj` 2. Execute: `agents plan execute <PLAN_ID> --format json` 3. Observe: raw plan state dict without sandbox/progress/worker fields ## Subtasks - [ ] Create `_execute_output_dict(plan, executor_result)` function that builds the spec-required execute output structure - [ ] Add sandbox info (strategy, path, branch, status) to execute output - [ ] Add worker, started, attempt, strategy_summary, progress fields - [ ] Wrap in spec-required JSON envelope (command, status, exit_code, data, timing, messages) - [ ] Update `execute_plan()` to use new output function when `fmt != "rich"` - [ ] Add BDD unit tests for `plan execute --format json` output structure - [ ] Verify `nox -e typecheck` passes - [ ] Verify coverage >= 97% ## Definition of Done - [ ] `agents plan execute --format json` outputs the spec-required structure with sandbox, worker, progress fields - [ ] 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 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: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.2.0 milestone 2026-04-05 16:49:50 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical — plan execute --format json outputs raw domain model dict instead of the spec-required structure with sandbox, worker, progress, and strategy_summary fields. Breaks programmatic consumers.
  • Milestone: v3.2.0 (already assigned)
  • Story Points: 3 (M) — Similar scope to #3442. Requires new output builder function for execute-specific fields + envelope wrapping + tests.
  • MoSCoW: Must Have — The spec mandates this output structure (§CLI Output Format). Related to #3431 (missing envelope) but this issue additionally requires execute-specific fields (sandbox, worker, progress) that go beyond the envelope fix.
  • Parent Epic: #933 (A2A Protocol Compliance)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical — `plan execute --format json` outputs raw domain model dict instead of the spec-required structure with sandbox, worker, progress, and strategy_summary fields. Breaks programmatic consumers. - **Milestone**: v3.2.0 (already assigned) - **Story Points**: 3 (M) — Similar scope to #3442. Requires new output builder function for execute-specific fields + envelope wrapping + tests. - **MoSCoW**: Must Have — The spec mandates this output structure (§CLI Output Format). Related to #3431 (missing envelope) but this issue additionally requires execute-specific fields (sandbox, worker, progress) that go beyond the envelope fix. - **Parent Epic**: #933 (A2A Protocol Compliance) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

PR #3465 created on branch bugfix/m3-plan-execute-json-output-spec. I will monitor and handle all review feedback until merged.

Implementation summary:

  • Added _execute_output_dict() function that builds the spec-required JSON envelope with command, status, exit_code, data, timing, messages fields
  • data contains plan_id, phase, sandbox (strategy/path/branch/status), worker, started, attempt, strategy_summary, progress
  • Updated execute_plan() to use the new function for non-rich output formats
  • Added BDD tests verifying the spec-required structure

Quality gates passed:

  • lint
  • typecheck (0 errors)
  • unit_tests (88 scenarios passed)

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3465 created on branch `bugfix/m3-plan-execute-json-output-spec`. I will monitor and handle all review feedback until merged. **Implementation summary:** - Added `_execute_output_dict()` function that builds the spec-required JSON envelope with `command`, `status`, `exit_code`, `data`, `timing`, `messages` fields - `data` contains `plan_id`, `phase`, `sandbox` (strategy/path/branch/status), `worker`, `started`, `attempt`, `strategy_summary`, `progress` - Updated `execute_plan()` to use the new function for non-rich output formats - Added BDD tests verifying the spec-required structure **Quality gates passed:** - ✅ lint - ✅ typecheck (0 errors) - ✅ unit_tests (88 scenarios passed) --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

Label compliance fix applied:

  • Added missing label: Priority/Critical
  • Added missing label: Type/Bug
  • Reason: Issue was missing required Priority/* and Type/* labels per CONTRIBUTING.md. Inferred Type/Bug from UAT issue title. Applied Priority/Critical based on the issue body context (spec-required output fields missing from a core CLI command in v3.2.0 milestone).

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

Label compliance fix applied: - Added missing label: `Priority/Critical` - Added missing label: `Type/Bug` - Reason: Issue was missing required Priority/* and Type/* labels per CONTRIBUTING.md. Inferred `Type/Bug` from UAT issue title. Applied `Priority/Critical` based on the issue body context (spec-required output fields missing from a core CLI command in v3.2.0 milestone). --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
freemo removed this from the v3.2.0 milestone 2026-04-06 20:50:10 +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.

Reference
cleveragents/cleveragents-core#3435
No description provided.