UAT: agents plan correct JSON output format does not match spec — flat structure instead of nested correction/affected_subtree/sandbox_rollback/recompute/history #3107

Open
opened 2026-04-05 06:18:40 +00:00 by freemo · 2 comments
Owner

Summary

The agents plan correct command's JSON output (--format json) returns a flat structure that does not match the spec-defined nested format. Any tooling or scripts that parse the JSON output will fail.

Metadata

  • Branch: fix/plan-correct-json-output-spec-alignment
  • Commit Message: fix(cli): align plan correct JSON output with spec-defined nested structure
  • Milestone: v3.2.0
  • Parent Epic: #394

Subtasks

  • Update correct_decision() in src/cleveragents/cli/commands/plan.py to emit spec-compliant JSON
  • Add correction, affected_subtree, sandbox_rollback, recompute, history top-level keys
  • Add unit tests (Behave) verifying JSON output structure
  • Add integration test (Robot Framework) for --format json output

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • agents plan correct <id> --mode revert --guidance "..." --yes --format json emits JSON matching the spec schema
  • agents plan correct <id> --mode append --guidance "..." --format json emits JSON matching the spec schema
  • All existing tests pass
  • 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%

Bug Details

What was tested

agents plan correct --format json output structure (code analysis of src/cleveragents/cli/commands/plan.py lines 3115–3123)

Expected behavior (from spec § agents plan correct, JSON tab)

{
  "command": "plan correct",
  "status": "ok",
  "exit_code": 0,
  "data": {
    "correction": {
      "mode": "revert",
      "impact": "3 decisions, 2 child plans, 5 artifacts",
      "new_decision": "01HXM9B7Z3Q1Q8K2E9H7K3W2M8",
      "corrects": "01HXM9A1C2Q7W3R5G8Z0P4Q1X9",
      "attempt": 2
    },
    "affected_subtree": {
      "decisions_invalidated": 3,
      "child_plans_rolled_back": 2,
      "artifacts_archived": 5,
      "unaffected_decisions": 2
    },
    "sandbox_rollback": {
      "checkpoint": "cp_01HXM8C2",
      "files_reverted": 5,
      "status": "restored"
    },
    "recompute": {
      "queued": "2 child plans",
      "eta": "4m"
    },
    "history": [
      "Original decision superseded",
      "Prior artifacts archived for comparison",
      "agents plan diff --correction 01HXM9B7Z3Q1Q8K2.."
    ]
  },
  "messages": ["Correction applied"]
}

Actual behavior (from implementation)

# src/cleveragents/cli/commands/plan.py lines 3115-3123
data = {
    "correction_id": result.correction_id,
    "status": result.status.value,
    "mode": correction_mode.value,
    "new_decisions": result.new_decisions,
    "reverted_decisions": result.reverted_decisions,
}

The implementation returns a flat structure with correction_id, status, mode, new_decisions, reverted_decisions — completely different from the spec.

Code location

src/cleveragents/cli/commands/plan.py, function correct_decision(), lines 3115–3123

Steps to reproduce

  1. Create a plan with a decision
  2. Run: agents plan correct <decision_id> --mode revert --guidance "test" --yes --format json
  3. Observe the flat JSON structure instead of the nested spec-compliant structure

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

## Summary The `agents plan correct` command's JSON output (`--format json`) returns a flat structure that does not match the spec-defined nested format. Any tooling or scripts that parse the JSON output will fail. ## Metadata - **Branch**: `fix/plan-correct-json-output-spec-alignment` - **Commit Message**: `fix(cli): align plan correct JSON output with spec-defined nested structure` - **Milestone**: v3.2.0 - **Parent Epic**: #394 ## Subtasks - [ ] Update `correct_decision()` in `src/cleveragents/cli/commands/plan.py` to emit spec-compliant JSON - [ ] Add `correction`, `affected_subtree`, `sandbox_rollback`, `recompute`, `history` top-level keys - [ ] Add unit tests (Behave) verifying JSON output structure - [ ] Add integration test (Robot Framework) for `--format json` output ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `agents plan correct <id> --mode revert --guidance "..." --yes --format json` emits JSON matching the spec schema - `agents plan correct <id> --mode append --guidance "..." --format json` emits JSON matching the spec schema - All existing tests pass - 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% ## Bug Details ### What was tested `agents plan correct --format json` output structure (code analysis of `src/cleveragents/cli/commands/plan.py` lines 3115–3123) ### Expected behavior (from spec § agents plan correct, JSON tab) ```json { "command": "plan correct", "status": "ok", "exit_code": 0, "data": { "correction": { "mode": "revert", "impact": "3 decisions, 2 child plans, 5 artifacts", "new_decision": "01HXM9B7Z3Q1Q8K2E9H7K3W2M8", "corrects": "01HXM9A1C2Q7W3R5G8Z0P4Q1X9", "attempt": 2 }, "affected_subtree": { "decisions_invalidated": 3, "child_plans_rolled_back": 2, "artifacts_archived": 5, "unaffected_decisions": 2 }, "sandbox_rollback": { "checkpoint": "cp_01HXM8C2", "files_reverted": 5, "status": "restored" }, "recompute": { "queued": "2 child plans", "eta": "4m" }, "history": [ "Original decision superseded", "Prior artifacts archived for comparison", "agents plan diff --correction 01HXM9B7Z3Q1Q8K2.." ] }, "messages": ["Correction applied"] } ``` ### Actual behavior (from implementation) ```python # src/cleveragents/cli/commands/plan.py lines 3115-3123 data = { "correction_id": result.correction_id, "status": result.status.value, "mode": correction_mode.value, "new_decisions": result.new_decisions, "reverted_decisions": result.reverted_decisions, } ``` The implementation returns a flat structure with `correction_id`, `status`, `mode`, `new_decisions`, `reverted_decisions` — completely different from the spec. ### Code location `src/cleveragents/cli/commands/plan.py`, function `correct_decision()`, lines 3115–3123 ### Steps to reproduce 1. Create a plan with a decision 2. Run: `agents plan correct <decision_id> --mode revert --guidance "test" --yes --format json` 3. Observe the flat JSON structure instead of the nested spec-compliant structure --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.2.0 milestone 2026-04-05 06:18:47 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Critical (keeping existing — JSON output format is a spec contract)
  • Milestone: v3.2.0 (already assigned, keeping)
  • MoSCoW: Must Have — the spec defines the exact JSON output schema for plan correct. Any tooling or A2A clients that parse this output will break with the current flat structure.
  • Parent Epic: #394 (Decision Framework)

Part of the correction-flow bug cluster (#3107, #3108, #3109, #3113, #3114).


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

Issue triaged by project owner: - **State**: Verified - **Priority**: Critical (keeping existing — JSON output format is a spec contract) - **Milestone**: v3.2.0 (already assigned, keeping) - **MoSCoW**: Must Have — the spec defines the exact JSON output schema for `plan correct`. Any tooling or A2A clients that parse this output will break with the current flat structure. - **Parent Epic**: #394 (Decision Framework) Part of the correction-flow bug cluster (#3107, #3108, #3109, #3113, #3114). --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
Author
Owner

Starting implementation on branch fix/plan-correct-json-output-spec-alignment.

Difficulty assessment: Medium → starting at sonnet tier.

Implementation plan:

  1. Update correct_decision() in src/cleveragents/cli/commands/plan.py to emit spec-compliant nested JSON
  2. Add BDD tests verifying JSON output structure for revert, append, and dry-run modes

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

Starting implementation on branch `fix/plan-correct-json-output-spec-alignment`. Difficulty assessment: Medium → starting at sonnet tier. **Implementation plan:** 1. Update `correct_decision()` in `src/cleveragents/cli/commands/plan.py` to emit spec-compliant nested JSON 2. Add BDD tests verifying JSON output structure for revert, append, and dry-run modes --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
freemo removed this from the v3.2.0 milestone 2026-04-06 20:50:35 +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#3107
No description provided.