BUG-HUNT: [data-integrity] cross_plan_correction_service.py _rollback_completed_actions is hollow — only logs, performs no actual rollback #7485

Open
opened 2026-04-10 20:47:02 +00:00 by HAL9000 · 1 comment
Owner

Bug Report: Data Integrity — _rollback_completed_actions Performs No Actual Rollback

Severity Assessment

  • Impact: Complete loss of atomicity guarantee for cascade operations — failed mid-cascade leaves child plans in partially-cancelled state with no recovery
  • Likelihood: Any cascade failure triggers this
  • Priority: Critical

Location

  • File: src/cleveragents/application/services/cross_plan_correction_service.py
  • Function: _rollback_completed_actions
  • Lines: 340–355
  • Category: data-integrity

Description

The rollback method that is supposed to enforce atomicity is completely hollow. It only calls logger.info() — it never calls _plan_canceller, _sandbox_rollbacker, or any actual undo operation. The entire atomicity guarantee advertised in the class docstring and in execute_cascade ("if any action fails mid-cascade, all completed actions are rolled back") is non-functional.

Evidence

def _rollback_completed_actions(self, completed_actions: list[CascadeAction]) -> None:
    for action in reversed(completed_actions):
        try:
            logger.info(            # ← this is ALL that happens — no actual rollback
                "cross_plan_correction.rollback_action",
                child_plan_id=action.child_plan_id,
            )
        except Exception as rollback_exc:   # ← catches logger failures, not rollback failures
            logger.error(
                "cross_plan_correction.rollback_action_failed",
                ...
            )

A failure partway through execute_cascade calls this method believing rollback will occur. Instead, the cascade is left in a partially-applied state permanently.

Expected Behavior

_rollback_completed_actions should reverse completed actions (uncancel plans, restore sandboxes) when a cascade fails mid-execution.

Actual Behavior

Method only logs a message. No actual state is reversed. The atomicity guarantee is completely absent.

Suggested Fix

def _rollback_completed_actions(self, completed_actions: list[CascadeAction]) -> None:
    for action in reversed(completed_actions):
        try:
            if action.sandbox_rolled_back:
                self._sandbox_rollbacker.restore_child_plan_sandbox(action.child_plan_id)
            self._plan_canceller.uncancel_child_plan(action.child_plan_id)
            logger.info("cross_plan_correction.rollback_action", ...)
        except Exception as rollback_exc:
            logger.error("cross_plan_correction.rollback_action_failed", ...)

Category

data-integrity

TDD Note

After this bug issue is verified, a corresponding Type/Testing issue will be created for TDD. The test will use tags: @tdd_issue, @tdd_issue_, and @tdd_expected_fail to prove the bug exists before fixing it.


Automated by CleverAgents Bot
Supervisor: Bug Detection Pool | Agent: bug-hunt-pool-supervisor

## Bug Report: Data Integrity — `_rollback_completed_actions` Performs No Actual Rollback ### Severity Assessment - **Impact**: Complete loss of atomicity guarantee for cascade operations — failed mid-cascade leaves child plans in partially-cancelled state with no recovery - **Likelihood**: Any cascade failure triggers this - **Priority**: Critical ### Location - **File**: `src/cleveragents/application/services/cross_plan_correction_service.py` - **Function**: `_rollback_completed_actions` - **Lines**: 340–355 - **Category**: data-integrity ### Description The rollback method that is supposed to enforce atomicity is completely hollow. It only calls `logger.info()` — it never calls `_plan_canceller`, `_sandbox_rollbacker`, or any actual undo operation. The entire atomicity guarantee advertised in the class docstring and in `execute_cascade` ("if any action fails mid-cascade, all completed actions are rolled back") is non-functional. ### Evidence ```python def _rollback_completed_actions(self, completed_actions: list[CascadeAction]) -> None: for action in reversed(completed_actions): try: logger.info( # ← this is ALL that happens — no actual rollback "cross_plan_correction.rollback_action", child_plan_id=action.child_plan_id, ) except Exception as rollback_exc: # ← catches logger failures, not rollback failures logger.error( "cross_plan_correction.rollback_action_failed", ... ) ``` A failure partway through `execute_cascade` calls this method believing rollback will occur. Instead, the cascade is left in a partially-applied state permanently. ### Expected Behavior `_rollback_completed_actions` should reverse completed actions (uncancel plans, restore sandboxes) when a cascade fails mid-execution. ### Actual Behavior Method only logs a message. No actual state is reversed. The atomicity guarantee is completely absent. ### Suggested Fix ```python def _rollback_completed_actions(self, completed_actions: list[CascadeAction]) -> None: for action in reversed(completed_actions): try: if action.sandbox_rolled_back: self._sandbox_rollbacker.restore_child_plan_sandbox(action.child_plan_id) self._plan_canceller.uncancel_child_plan(action.child_plan_id) logger.info("cross_plan_correction.rollback_action", ...) except Exception as rollback_exc: logger.error("cross_plan_correction.rollback_action_failed", ...) ``` ### Category data-integrity ### TDD Note After this bug issue is verified, a corresponding Type/Testing issue will be created for TDD. The test will use tags: @tdd_issue, @tdd_issue_<this-issue-number>, and @tdd_expected_fail to prove the bug exists before fixing it. --- **Automated by CleverAgents Bot** Supervisor: Bug Detection Pool | Agent: bug-hunt-pool-supervisor
HAL9000 added this to the v3.3.0 milestone 2026-04-10 21:38:50 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — Correctness bug in subplan/correction/merge logic that directly impacts M4 milestone functionality
  • Milestone: v3.3.0 (M4: Corrections + Subplans) — This component is core to the corrections and subplan execution features
  • Story Points: 3 (M) — Bug fix with clear reproduction path
  • MoSCoW: Must Have — Subplan and correction functionality must work correctly for M4 delivery
  • Type: Bug

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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — Correctness bug in subplan/correction/merge logic that directly impacts M4 milestone functionality - **Milestone**: v3.3.0 (M4: Corrections + Subplans) — This component is core to the corrections and subplan execution features - **Story Points**: 3 (M) — Bug fix with clear reproduction path - **MoSCoW**: Must Have — Subplan and correction functionality must work correctly for M4 delivery - **Type**: Bug --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-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#7485
No description provided.