UAT: agents plan rollback does not invalidate decisions or cancel child plans created after the checkpoint #5084

Open
opened 2026-04-09 00:57:07 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature Area: Sandbox and Checkpoint
Tested By: UAT worker (uat-pool-1), feature area: Sandbox and Checkpoint
Severity: High (rollback is incomplete — decision tree and child plans are not reverted, leaving the plan in an inconsistent state)


What Was Tested

The agents plan rollback command was analyzed to verify it performs all required rollback operations as defined in the specification (§CLI Commands — agents plan rollback, lines 16044–16045 and §Checkpointing in Execute, lines 19396–19441).

Expected Behavior (from spec)

The spec states (line 16044–16045):

Rollback a plan sandbox to a previous checkpoint. All changes made after the target checkpoint are reverted: files are restored or removed, decisions are discarded, and tool calls are undone. Child plans spawned after the checkpoint are invalidated.

The spec also defines the plan rollback output as including:

  • impact.child_plans_invalidated: number of child plans cancelled
  • impact.decisions_after_cp: number of decisions discarded
  • impact.tool_calls_after_cp: number of tool calls undone

Actual Behavior (from code)

The rollback_plan function in src/cleveragents/cli/commands/plan.py calls svc.selective_rollback(plan_id, resolved_checkpoint_id), which delegates to CheckpointService.rollback_to_checkpoint().

CheckpointService.rollback_to_checkpoint() (in src/cleveragents/application/services/checkpoint_service.py) only performs:

  1. git reset --hard <sandbox_ref> — restores files ✓
  2. git clean -fd — removes untracked files ✓

It does NOT:

  • Invalidate/supersede decisions created after the checkpoint
  • Cancel child plans spawned after the checkpoint
  • Track or report tool calls undone

After rollback, the plan's decision tree still contains all decisions made after the checkpoint, even though the sandbox files have been reverted. This creates an inconsistent state where the decision tree no longer reflects the actual sandbox state.

Code Location

  • src/cleveragents/application/services/checkpoint_service.py, rollback_to_checkpoint() method (lines ~200–280)
  • src/cleveragents/cli/commands/plan.py, rollback_plan() function (lines 3533–3800)

Steps to Reproduce

  1. Create a plan and execute it to generate several decisions and child plans
  2. Create a checkpoint at an early point
  3. Continue execution to create more decisions and child plans
  4. Run agents plan rollback <PLAN_ID> <CHECKPOINT_ID>
  5. Expected: Files reverted, decisions after checkpoint invalidated, child plans cancelled
  6. Actual: Only files are reverted; decisions and child plans remain unchanged

Impact

This is a critical correctness issue for the rollback feature:

  • The plan's decision tree is inconsistent with the sandbox state after rollback
  • Child plans that were spawned after the checkpoint remain active and may continue executing against the reverted sandbox
  • Re-running agents plan execute after rollback will encounter stale decisions that reference files that no longer exist
  • The spec's safety guarantee ("All changes made after the target checkpoint are reverted") is violated

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature Area**: Sandbox and Checkpoint **Tested By**: UAT worker (uat-pool-1), feature area: Sandbox and Checkpoint **Severity**: High (rollback is incomplete — decision tree and child plans are not reverted, leaving the plan in an inconsistent state) --- ## What Was Tested The `agents plan rollback` command was analyzed to verify it performs all required rollback operations as defined in the specification (§CLI Commands — agents plan rollback, lines 16044–16045 and §Checkpointing in Execute, lines 19396–19441). ## Expected Behavior (from spec) The spec states (line 16044–16045): > Rollback a plan sandbox to a previous checkpoint. All changes made after the target checkpoint are **reverted**: files are restored or removed, **decisions are discarded**, and **tool calls are undone**. **Child plans spawned after the checkpoint are invalidated.** The spec also defines the `plan rollback` output as including: - `impact.child_plans_invalidated`: number of child plans cancelled - `impact.decisions_after_cp`: number of decisions discarded - `impact.tool_calls_after_cp`: number of tool calls undone ## Actual Behavior (from code) The `rollback_plan` function in `src/cleveragents/cli/commands/plan.py` calls `svc.selective_rollback(plan_id, resolved_checkpoint_id)`, which delegates to `CheckpointService.rollback_to_checkpoint()`. `CheckpointService.rollback_to_checkpoint()` (in `src/cleveragents/application/services/checkpoint_service.py`) only performs: 1. `git reset --hard <sandbox_ref>` — restores files ✓ 2. `git clean -fd` — removes untracked files ✓ It does **NOT**: - ❌ Invalidate/supersede decisions created after the checkpoint - ❌ Cancel child plans spawned after the checkpoint - ❌ Track or report tool calls undone After rollback, the plan's decision tree still contains all decisions made after the checkpoint, even though the sandbox files have been reverted. This creates an inconsistent state where the decision tree no longer reflects the actual sandbox state. ## Code Location - `src/cleveragents/application/services/checkpoint_service.py`, `rollback_to_checkpoint()` method (lines ~200–280) - `src/cleveragents/cli/commands/plan.py`, `rollback_plan()` function (lines 3533–3800) ## Steps to Reproduce 1. Create a plan and execute it to generate several decisions and child plans 2. Create a checkpoint at an early point 3. Continue execution to create more decisions and child plans 4. Run `agents plan rollback <PLAN_ID> <CHECKPOINT_ID>` 5. Expected: Files reverted, decisions after checkpoint invalidated, child plans cancelled 6. Actual: Only files are reverted; decisions and child plans remain unchanged ## Impact This is a critical correctness issue for the rollback feature: - The plan's decision tree is inconsistent with the sandbox state after rollback - Child plans that were spawned after the checkpoint remain active and may continue executing against the reverted sandbox - Re-running `agents plan execute` after rollback will encounter stale decisions that reference files that no longer exist - The spec's safety guarantee ("All changes made after the target checkpoint are reverted") is violated --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 01:01:26 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: High — Spec compliance bug that breaks documented behavior
  • Milestone: v3.2.0
  • Story Points: 3 — M
  • MoSCoW: Must Have — Spec compliance is required

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

Issue triaged by project owner: - **State**: Verified - **Priority**: High — Spec compliance bug that breaks documented behavior - **Milestone**: v3.2.0 - **Story Points**: 3 — M - **MoSCoW**: Must Have — Spec compliance is required --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
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#5084
No description provided.