Files
cleveragents-core/features/checkpoint_wiring.feature
hamza.khyari bdd1ea4f3a
CI / push-validation (pull_request) Successful in 10s
CI / build (pull_request) Successful in 16s
CI / helm (pull_request) Successful in 16s
CI / typecheck (pull_request) Successful in 30s
CI / lint (pull_request) Successful in 35s
CI / quality (pull_request) Successful in 35s
CI / security (pull_request) Successful in 50s
CI / integration_tests (pull_request) Successful in 4m3s
CI / e2e_tests (pull_request) Successful in 4m14s
CI / unit_tests (pull_request) Successful in 5m13s
CI / docker (pull_request) Successful in 8s
CI / coverage (pull_request) Successful in 11m2s
CI / status-check (pull_request) Successful in 1s
fix(checkpoint): wire CheckpointManager into PlanExecutor execution path
CheckpointManager was never wired into PlanExecutor — the CLI factory
constructed PlanExecutor without a checkpoint_manager (defaulted to
None), silently skipping all checkpoint hooks.

Fix:
- Register CheckpointManager as Singleton in DI container
- Resolve container singleton in _get_plan_executor() and pass to
  PlanExecutor constructor
- Bridge infra→domain: _try_create_checkpoint() now persists
  last_checkpoint_id on the plan via _commit_plan(), raises PlanError
  if persistence fails
- Default checkpointable=True for writable+sandboxable resources and
  write-capable tools (model_validators on ResourceCapabilities and
  ToolCapability)
- Validate that non-writable/non-sandboxable resources cannot be
  checkpointable (ValueError guard)
- Add post-execute A2A facade notification using plan.status to avoid
  duplicate execute→execute transition errors

Tests:
- 10 Behave scenarios covering DI wiring, singleton identity, checkpoint
  creation, plan metadata update, rollback, graceful fallback, no-arg
  constructor, capability defaults (positive + 2 negative)
- Updated consolidated_resource, consolidated_skill, and Robot
  helper_skill_flatten for new checkpointable defaults

ISSUES CLOSED: #1253
2026-04-17 11:46:38 +00:00

64 lines
3.5 KiB
Gherkin

@checkpoint-wiring
Feature: CheckpointManager wired into PlanExecutor (#1253)
Verifies that checkpoints are automatically created during
plan execution and that last_checkpoint_id is set on the plan.
Scenario: PlanExecutor receives CheckpointManager from CLI factory for ckpt_wire
When I build a PlanExecutor via _get_plan_executor for ckpt_wire
Then the executor checkpoint_manager should not be None for ckpt_wire
Scenario: PlanExecutor reuses CheckpointManager singleton from DI container for ckpt_wire
When I build a PlanExecutor via _get_plan_executor for ckpt_wire
And I get CheckpointManager from the DI container for ckpt_wire
Then the executor checkpoint_manager should be the container singleton for ckpt_wire
Scenario: CheckpointManager is registered in DI container for ckpt_wire
When I get CheckpointManager from the DI container for ckpt_wire
Then the container checkpoint_manager should not be None for ckpt_wire
Scenario: _try_create_checkpoint creates real checkpoint when manager present for ckpt_wire
Given a PlanExecutor with a real CheckpointManager for ckpt_wire
And a plan exists in the lifecycle service for ckpt_wire
And a sandbox exists for the test plan for ckpt_wire
When I call _try_create_checkpoint for ckpt_wire
Then a SandboxCheckpoint should be returned for ckpt_wire
Scenario: _try_create_checkpoint returns None when manager is None for ckpt_wire
Given a PlanExecutor with no CheckpointManager for ckpt_wire
When I call _try_create_checkpoint for ckpt_wire
Then None should be returned for ckpt_wire
Scenario: Checkpoint creation sets last_checkpoint_id on plan for ckpt_wire
Given a PlanExecutor with a real CheckpointManager for ckpt_wire
And a plan exists in the lifecycle service for ckpt_wire
And a sandbox exists for the test plan for ckpt_wire
When I call _try_create_checkpoint for ckpt_wire
Then the plan last_checkpoint_id should not be None for ckpt_wire
Scenario: Plan rollback restores sandbox from auto checkpoint for ckpt_wire
Given a PlanExecutor with a real CheckpointManager for ckpt_wire
And a plan exists in the lifecycle service for ckpt_wire
And a sandbox exists for the test plan for ckpt_wire
When I call _try_create_checkpoint for ckpt_wire
And I mutate the sandbox file for ckpt_wire
And I rollback to the last checkpoint via the executor for ckpt_wire
Then rollback should succeed for ckpt_wire
And the sandbox file should match the original contents for ckpt_wire
Scenario: CheckpointManager takes no constructor arguments for ckpt_wire
When I instantiate CheckpointManager with no args for ckpt_wire
Then CheckpointManager should be created successfully for ckpt_wire
Scenario: Writable tools and resources default to checkpointable for ckpt_wire
When I create default capabilities for a writable resource for ckpt_wire
And I create default capabilities for a writable tool for ckpt_wire
Then the resource capability should be checkpointable for ckpt_wire
And the tool capability should be checkpointable for ckpt_wire
Scenario: Non-writable resource defaults to not checkpointable for ckpt_wire
When I create capabilities for a non-writable resource for ckpt_wire
Then the resource capability should not be checkpointable for ckpt_wire
Scenario: Non-writable resource with explicit checkpointable raises error for ckpt_wire
Then creating a non-writable resource with checkpointable True should raise ValueError for ckpt_wire