TDD: agents plan correct --mode=revert CLI output omits re-execution metadata fields #10236

Open
opened 2026-04-17 09:13:57 +00:00 by HAL9000 · 0 comments
Owner

Metadata

  • Commit Message: test(plan-correct): add tdd_expected_fail scenario for missing revert re-execution metadata in CLI output
  • Branch: test/tdd-plan-correct-revert-output-metadata

Background and Context

The agents plan correct --mode=revert command calls CorrectionService.execute_correction() which returns a CorrectionResult containing re-execution metadata fields required by the v3.2.0 spec (§ Correction Flow, Revert Mode):

  • phase_transition_target — signals that the plan should re-enter Strategize phase
  • checkpoint_restored — whether sandbox checkpoint was restored
  • actor_state_ref — LangGraph actor checkpoint reference for reasoning rollback
  • user_intervention_decision_id — ULID of the user_intervention decision

The CLI handler in src/cleveragents/cli/commands/plan.py (correct_decision function, around line 3698) only outputs correction_id, status, mode, new_decisions, and reverted_decisions in its JSON envelope. The four re-execution metadata fields are computed by the service but silently discarded by the CLI.

Current Behavior

When agents plan correct --mode=revert is invoked with --format json, the output envelope is:

{
  "correction_id": "...",
  "status": "applied",
  "mode": "revert",
  "new_decisions": [],
  "reverted_decisions": ["D1", "D2", "D3"]
}

The fields phase_transition_target, checkpoint_restored, actor_state_ref, and user_intervention_decision_id are absent.

Expected Behavior

Per spec v3.2.0 §Correction Flow (Revert Mode), the CLI output for --mode=revert should include all re-execution metadata:

{
  "correction_id": "...",
  "status": "applied",
  "mode": "revert",
  "new_decisions": [],
  "reverted_decisions": ["D1", "D2", "D3"],
  "phase_transition_target": "strategize",
  "checkpoint_restored": false,
  "actor_state_ref": "",
  "user_intervention_decision_id": "01HXYZ..."
}

Acceptance Criteria

  • A @tdd_expected_fail Behave scenario exists that invokes agents plan correct --mode=revert --format json and asserts that phase_transition_target is present in the JSON output
  • The scenario fails (as expected) until the bug is fixed
  • The scenario uses the @tdd_expected_fail tag so CI passes while the bug is unfixed

Supporting Information

  • Spec: v3.2.0 §Correction Flow (Revert Mode) — "Phase transition: signals that the plan should re-enter the Strategize phase from the corrected decision point"
  • Source: src/cleveragents/cli/commands/plan.py correct_decision function ~line 3698
  • Service layer correctly sets phase_transition_target="strategize" in CorrectionService.execute_revert() (src/cleveragents/application/services/correction_service.py ~line 518)
  • CorrectionResult model has all four fields defined (src/cleveragents/domain/models/core/correction.py)

Subtasks

  • Write a @tdd_expected_fail Behave scenario in a new feature file features/tdd_plan_correct_revert_output_metadata.feature
  • Implement step definitions in features/steps/tdd_plan_correct_revert_output_metadata_steps.py
  • Verify the scenario fails (as expected) with @tdd_expected_fail tag
  • 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.
  • 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.
  • 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.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata - **Commit Message**: `test(plan-correct): add tdd_expected_fail scenario for missing revert re-execution metadata in CLI output` - **Branch**: `test/tdd-plan-correct-revert-output-metadata` ## Background and Context The `agents plan correct --mode=revert` command calls `CorrectionService.execute_correction()` which returns a `CorrectionResult` containing re-execution metadata fields required by the v3.2.0 spec (§ Correction Flow, Revert Mode): - `phase_transition_target` — signals that the plan should re-enter Strategize phase - `checkpoint_restored` — whether sandbox checkpoint was restored - `actor_state_ref` — LangGraph actor checkpoint reference for reasoning rollback - `user_intervention_decision_id` — ULID of the user_intervention decision The CLI handler in `src/cleveragents/cli/commands/plan.py` (`correct_decision` function, around line 3698) only outputs `correction_id`, `status`, `mode`, `new_decisions`, and `reverted_decisions` in its JSON envelope. The four re-execution metadata fields are computed by the service but silently discarded by the CLI. ## Current Behavior When `agents plan correct --mode=revert` is invoked with `--format json`, the output envelope is: ```json { "correction_id": "...", "status": "applied", "mode": "revert", "new_decisions": [], "reverted_decisions": ["D1", "D2", "D3"] } ``` The fields `phase_transition_target`, `checkpoint_restored`, `actor_state_ref`, and `user_intervention_decision_id` are absent. ## Expected Behavior Per spec v3.2.0 §Correction Flow (Revert Mode), the CLI output for `--mode=revert` should include all re-execution metadata: ```json { "correction_id": "...", "status": "applied", "mode": "revert", "new_decisions": [], "reverted_decisions": ["D1", "D2", "D3"], "phase_transition_target": "strategize", "checkpoint_restored": false, "actor_state_ref": "", "user_intervention_decision_id": "01HXYZ..." } ``` ## Acceptance Criteria - A `@tdd_expected_fail` Behave scenario exists that invokes `agents plan correct --mode=revert --format json` and asserts that `phase_transition_target` is present in the JSON output - The scenario fails (as expected) until the bug is fixed - The scenario uses the `@tdd_expected_fail` tag so CI passes while the bug is unfixed ## Supporting Information - Spec: v3.2.0 §Correction Flow (Revert Mode) — "Phase transition: signals that the plan should re-enter the Strategize phase from the corrected decision point" - Source: `src/cleveragents/cli/commands/plan.py` `correct_decision` function ~line 3698 - Service layer correctly sets `phase_transition_target="strategize"` in `CorrectionService.execute_revert()` (`src/cleveragents/application/services/correction_service.py` ~line 518) - `CorrectionResult` model has all four fields defined (`src/cleveragents/domain/models/core/correction.py`) ## Subtasks - [ ] Write a `@tdd_expected_fail` Behave scenario in a new feature file `features/tdd_plan_correct_revert_output_metadata.feature` - [ ] Implement step definitions in `features/steps/tdd_plan_correct_revert_output_metadata_steps.py` - [ ] Verify the scenario fails (as expected) with `@tdd_expected_fail` tag - [ ] 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. - 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. - 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. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor
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.

Dependencies

No dependencies set.

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