feat(plan): implement real revert-mode re-execution from decision point #1153

Merged
brent.edwards merged 2 commits from feat/844-revert-mode-re-execution into master 2026-03-28 00:57:51 +00:00
Member

Summary

Implements the full revert-mode re-execution pipeline from the specification (§ Correction Flow, Revert Mode), enabling agents plan correct --mode=revert to truly re-execute from the targeted decision point rather than only logically marking decisions as superseded.

Changes

  • Resource rollback: CorrectionService.execute_revert now delegates to CheckpointService.rollback_to_checkpoint when a decision-aligned checkpoint exists, performing real git reset --hard in the sandbox. Gracefully degrades when checkpointing is unavailable.
  • Reasoning rollback: Extracts actor_state_ref from the target decision's ContextSnapshot for downstream LangGraph actor restoration.
  • Guidance injection: Generates a user_intervention decision ID for callers to record correction guidance in the decision tree.
  • Phase transition: Signals that the plan should re-enter Strategize via phase_transition_target="strategize" on the result.
  • Model extension: Added checkpoint_restored, actor_state_ref, user_intervention_decision_id, and phase_transition_target fields to CorrectionResult with backward-compatible defaults.
  • Dispatch update: execute_correction now accepts and forwards a decisions parameter.

Design Approach

Uses a signal-based architecture: rather than having CorrectionService directly manipulate plan state or LangGraph actors, the enhanced execute_revert returns signal fields on CorrectionResult that downstream consumers use for the full pipeline. This preserves separation of concerns.

Tests

  • Behave: 16 new BDD scenarios in features/revert_re_execution.feature
  • Robot: 7 integration tests in robot/revert_re_execution.robot
  • Coverage: 98% (above 97% threshold)

Quality Gates

Gate Status
nox -s lint Pass
nox -s typecheck Pass (0 errors)
nox -s unit_tests Pass (12376 scenarios, 0 failed)
nox -s integration_tests Pass (1631 passed, 3 pre-existing failures #647)
nox -s e2e_tests Pass (37 passed)
nox -s coverage_report Pass (98%)

Closes #844

## Summary Implements the full revert-mode re-execution pipeline from the specification (§ Correction Flow, Revert Mode), enabling `agents plan correct --mode=revert` to truly re-execute from the targeted decision point rather than only logically marking decisions as superseded. ### Changes - **Resource rollback**: `CorrectionService.execute_revert` now delegates to `CheckpointService.rollback_to_checkpoint` when a decision-aligned checkpoint exists, performing real `git reset --hard` in the sandbox. Gracefully degrades when checkpointing is unavailable. - **Reasoning rollback**: Extracts `actor_state_ref` from the target decision's `ContextSnapshot` for downstream LangGraph actor restoration. - **Guidance injection**: Generates a `user_intervention` decision ID for callers to record correction guidance in the decision tree. - **Phase transition**: Signals that the plan should re-enter Strategize via `phase_transition_target="strategize"` on the result. - **Model extension**: Added `checkpoint_restored`, `actor_state_ref`, `user_intervention_decision_id`, and `phase_transition_target` fields to `CorrectionResult` with backward-compatible defaults. - **Dispatch update**: `execute_correction` now accepts and forwards a `decisions` parameter. ### Design Approach Uses a signal-based architecture: rather than having `CorrectionService` directly manipulate plan state or LangGraph actors, the enhanced `execute_revert` returns signal fields on `CorrectionResult` that downstream consumers use for the full pipeline. This preserves separation of concerns. ### Tests - **Behave**: 16 new BDD scenarios in `features/revert_re_execution.feature` - **Robot**: 7 integration tests in `robot/revert_re_execution.robot` - **Coverage**: 98% (above 97% threshold) ### Quality Gates | Gate | Status | |------|--------| | `nox -s lint` | Pass | | `nox -s typecheck` | Pass (0 errors) | | `nox -s unit_tests` | Pass (12376 scenarios, 0 failed) | | `nox -s integration_tests` | Pass (1631 passed, 3 pre-existing failures #647) | | `nox -s e2e_tests` | Pass (37 passed) | | `nox -s coverage_report` | Pass (98%) | Closes #844
brent.edwards added this to the v3.2.0 milestone 2026-03-24 22:17:40 +00:00
brent.edwards added the
Type
Feature
label 2026-03-24 22:17:40 +00:00
Owner

Code Review Note

Unable to review — the branch feat/844-revert-mode-re-execution was not found on the remote. Please verify the branch exists and has been pushed.

## Code Review Note **Unable to review** — the branch `feat/844-revert-mode-re-execution` was not found on the remote. Please verify the branch exists and has been pushed.
brent.edwards force-pushed feat/844-revert-mode-re-execution from bb0f5f6426 to 28f9883963 2026-03-28 00:19:28 +00:00 Compare
brent.edwards force-pushed feat/844-revert-mode-re-execution from 28f9883963 to 4af22f8ac2 2026-03-28 00:32:41 +00:00 Compare
brent.edwards merged commit b46a0e6102 into master 2026-03-28 00:57:51 +00:00
brent.edwards deleted branch feat/844-revert-mode-re-execution 2026-03-28 00:57:52 +00:00
Sign in to join this conversation.
No Reviewers
No Label
Type
Feature
2 Participants
Notifications
Due Date
No due date set.
Reference: cleveragents/cleveragents-core#1153