UAT: create_workspace_snapshot() never called during plan execution — per-decision checkpoints missing #4015

Open
opened 2026-04-06 08:38:29 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/checkpoint-per-decision-not-called
  • Commit Message: fix(checkpoint): wire create_workspace_snapshot() into execute phase per-decision
  • Milestone: None (Backlog)
  • Parent Epic: #3374

Background and Context

The specification states:

"During the Execute phase of a plan, the system automatically creates checkpoints at key decision points or when a tool with the checkpointable=true capability is executed."

This is the foundation of the checkpoint-based time-travel feature that allows rolling back to specific decision points.

Current Behavior

CheckpointService.create_workspace_snapshot() is defined in src/cleveragents/application/services/checkpoint_service.py (line 408) but is never called anywhere during plan execution.

The PlanExecutor only creates two checkpoints per execution:

  • pre_execute — before execution starts (line 679, 736)
  • post_execute — after execution completes (line 701, 771)

There are no per-decision checkpoints created during the Execute phase.

Expected Behavior (per spec)

A checkpoint should be created before each decision is executed (or when a tool with checkpointable=true runs), so that:

  1. The CorrectionService.revert_decisions() can find a checkpoint aligned to the target decision (cp.decision_id == target_decision_id)
  2. Time-travel rollback to specific decision points works as described in the spec

Impact

The CorrectionService._restore_checkpoint_for_decision() method (line 857) searches for checkpoints where cp.decision_id == target_decision_id. Since no per-decision checkpoints are ever created, this search always returns empty, and checkpoint-based correction rollback silently falls back to no-op.

Steps to Reproduce

  1. Search codebase for calls to create_workspace_snapshot():

    grep -r "create_workspace_snapshot" src/
    

    Result: Only defined in checkpoint_service.py, never called.

  2. Inspect PlanExecutor._run_execute_with_stub() and _run_execute_with_runtime() — only _try_create_checkpoint() is called, which uses CheckpointManager (infrastructure layer), not CheckpointService.create_workspace_snapshot().

Code Location

  • src/cleveragents/application/services/checkpoint_service.pycreate_workspace_snapshot() defined but never called
  • src/cleveragents/application/services/plan_executor.py — only creates pre_execute/post_execute checkpoints
  • src/cleveragents/application/services/correction_service.py line 857 — searches for decision-aligned checkpoints that don't exist

Fix Required

Wire CheckpointService.create_workspace_snapshot() into the Execute phase loop, calling it before each decision is executed, with the decision_id parameter set to the current decision's ULID.

Subtasks

  • Identify the correct injection point in PlanExecutor execute phase loop
  • Call CheckpointService.create_workspace_snapshot() before each decision execution, passing decision_id
  • Verify CorrectionService._restore_checkpoint_for_decision() can now find decision-aligned checkpoints
  • Add/update unit tests for per-decision checkpoint creation
  • Add/update integration tests verifying checkpoint-based rollback to a specific decision
  • Run nox (all default sessions), fix any errors
  • Verify coverage >= 97% via nox -s coverage_report

Definition of Done

  • All subtasks above are completed and checked off
  • create_workspace_snapshot() is called before each decision in the Execute phase
  • CorrectionService._restore_checkpoint_for_decision() successfully finds decision-aligned checkpoints
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly
  • 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%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


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

## Metadata - **Branch**: `fix/checkpoint-per-decision-not-called` - **Commit Message**: `fix(checkpoint): wire create_workspace_snapshot() into execute phase per-decision` - **Milestone**: None (Backlog) - **Parent Epic**: #3374 ## Background and Context The specification states: > "During the Execute phase of a plan, the system automatically creates checkpoints at key decision points or when a tool with the `checkpointable=true` capability is executed." This is the foundation of the checkpoint-based time-travel feature that allows rolling back to specific decision points. ## Current Behavior `CheckpointService.create_workspace_snapshot()` is defined in `src/cleveragents/application/services/checkpoint_service.py` (line 408) but is **never called** anywhere during plan execution. The `PlanExecutor` only creates two checkpoints per execution: - `pre_execute` — before execution starts (line 679, 736) - `post_execute` — after execution completes (line 701, 771) There are no per-decision checkpoints created during the Execute phase. ## Expected Behavior (per spec) A checkpoint should be created before each decision is executed (or when a tool with `checkpointable=true` runs), so that: 1. The `CorrectionService.revert_decisions()` can find a checkpoint aligned to the target decision (`cp.decision_id == target_decision_id`) 2. Time-travel rollback to specific decision points works as described in the spec ## Impact The `CorrectionService._restore_checkpoint_for_decision()` method (line 857) searches for checkpoints where `cp.decision_id == target_decision_id`. Since no per-decision checkpoints are ever created, this search always returns empty, and checkpoint-based correction rollback silently falls back to no-op. ## Steps to Reproduce 1. Search codebase for calls to `create_workspace_snapshot()`: ``` grep -r "create_workspace_snapshot" src/ ``` Result: Only defined in `checkpoint_service.py`, never called. 2. Inspect `PlanExecutor._run_execute_with_stub()` and `_run_execute_with_runtime()` — only `_try_create_checkpoint()` is called, which uses `CheckpointManager` (infrastructure layer), not `CheckpointService.create_workspace_snapshot()`. ## Code Location - `src/cleveragents/application/services/checkpoint_service.py` — `create_workspace_snapshot()` defined but never called - `src/cleveragents/application/services/plan_executor.py` — only creates `pre_execute`/`post_execute` checkpoints - `src/cleveragents/application/services/correction_service.py` line 857 — searches for decision-aligned checkpoints that don't exist ## Fix Required Wire `CheckpointService.create_workspace_snapshot()` into the Execute phase loop, calling it before each decision is executed, with the `decision_id` parameter set to the current decision's ULID. ## Subtasks - [ ] Identify the correct injection point in `PlanExecutor` execute phase loop - [ ] Call `CheckpointService.create_workspace_snapshot()` before each decision execution, passing `decision_id` - [ ] Verify `CorrectionService._restore_checkpoint_for_decision()` can now find decision-aligned checkpoints - [ ] Add/update unit tests for per-decision checkpoint creation - [ ] Add/update integration tests verifying checkpoint-based rollback to a specific decision - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage >= 97% via `nox -s coverage_report` ## Definition of Done - [ ] All subtasks above are completed and checked off - [ ] `create_workspace_snapshot()` is called before each decision in the Execute phase - [ ] `CorrectionService._restore_checkpoint_for_decision()` successfully finds decision-aligned checkpoints - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly - [ ] 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% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:00 +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.

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