UAT: DevcontainerHandler uses SandboxStrategy.NONE instead of snapshot — contradicts spec and ADR-043 #3544

Closed
opened 2026-04-05 19:10:34 +00:00 by freemo · 2 comments
Owner

Metadata

  • Branch: fix/devcontainer-handler-sandbox-strategy-snapshot
  • Commit Message: fix(resource): implement snapshot sandbox strategy for DevcontainerHandler per ADR-043
  • Milestone: (none — backlog)
  • Parent Epic: #398

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.

Background and Context

ADR-043 specifies that devcontainer-instance should use the snapshot sandbox strategy:

Sandbox strategy: snapshot (inherited)

The devcontainer-instance type definition in src/cleveragents/application/services/_resource_registry_data.py (line 209) correctly specifies "sandbox_strategy": "snapshot".

However, the DevcontainerHandler class in src/cleveragents/resource/handlers/devcontainer.py (line 155) overrides this with SandboxStrategy.NONE:

# F22/F25 fix: SNAPSHOT raises NotImplementedError in SandboxFactory.
# The container IS the sandbox for devcontainer-instance, so NONE is
# semantically correct until a dedicated container-snapshot strategy
# is implemented.
_default_strategy = SandboxStrategy.NONE

The comment acknowledges this is a deliberate temporary workaround because SandboxFactory has not implemented the snapshot strategy. This means the snapshot strategy is not actually implemented for devcontainers, and the handler silently falls back to NONE.

Current Behavior

  • DevcontainerHandler._default_strategy = SandboxStrategy.NONE (line 155 of devcontainer.py)
  • The snapshot strategy is not implemented in SandboxFactory, causing a NotImplementedError if invoked
  • Container-level checkpoints and rollback are not available for devcontainer resources
  • The create_sandbox() method in DevcontainerHandler (line 638) delegates to the base class with NONE strategy, providing no isolation
  • The type registry definition (_resource_registry_data.py line 209) says "sandbox_strategy": "snapshot" but the handler contradicts this at runtime

Expected Behavior

Per ADR-043 §Sandbox Coordination, devcontainer-instance should use the snapshot sandbox strategy, which provides container commit/checkpoint for rollback:

A devcontainer-instance creates a sandbox domain (inherited from container-instance). The sandbox strategy is snapshot — container commit/checkpoint for rollback.

Container-level checkpoints and rollback (as described in ADR-043 §Checkpoint Behavior) should be functional. Plans executing inside devcontainers should be able to roll back at the container level.

Acceptance Criteria

  • SandboxFactory implements the snapshot strategy for container-based resources
  • DevcontainerHandler._default_strategy is changed from SandboxStrategy.NONE to SandboxStrategy.SNAPSHOT
  • The workaround comment referencing "F22/F25 fix" is removed
  • create_sandbox() in DevcontainerHandler correctly creates a snapshot-based sandbox (container commit/checkpoint)
  • Rollback via the snapshot strategy restores the container to its pre-plan state
  • The type registry definition and the handler are consistent: both specify snapshot
  • No NotImplementedError is raised when SandboxFactory is invoked with snapshot strategy for a devcontainer

Supporting Information

  • Code locations:
    • src/cleveragents/resource/handlers/devcontainer.py line 155: _default_strategy = SandboxStrategy.NONE
    • src/cleveragents/application/services/_resource_registry_data.py line 209: "sandbox_strategy": "snapshot"
  • ADR reference: ADR-043 §Sandbox Coordination, §Checkpoint Behavior
  • Impact: Container-level checkpoints and rollback are non-functional for devcontainer resources; plans cannot be rolled back at the container level
  • Note: The comment in the code references "F22/F25 fix", indicating this was a deliberate temporary workaround. The root cause is that SandboxFactory needs to implement the snapshot strategy for containers.
  • Discovered by: UAT Testing agent during automated spec compliance review

Subtasks

  • Implement snapshot strategy in SandboxFactory for container-based resources (container commit/checkpoint)
  • Update DevcontainerHandler._default_strategy from SandboxStrategy.NONE to SandboxStrategy.SNAPSHOT
  • Remove the F22/F25 workaround comment from devcontainer.py line 155
  • Update create_sandbox() in DevcontainerHandler to correctly delegate to the snapshot strategy
  • Implement rollback via container restore from checkpoint/commit
  • Tests (unit): Add tests for SandboxFactory snapshot strategy with container resources
  • Tests (unit): Add tests for DevcontainerHandler.create_sandbox() using snapshot strategy
  • Tests (Behave): Add scenario verifying devcontainer sandbox uses snapshot strategy
  • Verify type registry definition and handler are consistent (both snapshot)
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • SandboxFactory implements the snapshot strategy for container resources without raising NotImplementedError.
  • DevcontainerHandler._default_strategy is SandboxStrategy.SNAPSHOT and the workaround comment is removed.
  • The type registry definition and handler are consistent — both specify snapshot.
  • Container-level checkpoint and rollback are functional for devcontainer resources.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • 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%.

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

## Metadata - **Branch**: `fix/devcontainer-handler-sandbox-strategy-snapshot` - **Commit Message**: `fix(resource): implement snapshot sandbox strategy for DevcontainerHandler per ADR-043` - **Milestone**: *(none — backlog)* - **Parent Epic**: #398 > **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. ## Background and Context ADR-043 specifies that `devcontainer-instance` should use the `snapshot` sandbox strategy: > **Sandbox strategy**: `snapshot` (inherited) The `devcontainer-instance` type definition in `src/cleveragents/application/services/_resource_registry_data.py` (line 209) correctly specifies `"sandbox_strategy": "snapshot"`. However, the `DevcontainerHandler` class in `src/cleveragents/resource/handlers/devcontainer.py` (line 155) overrides this with `SandboxStrategy.NONE`: ```python # F22/F25 fix: SNAPSHOT raises NotImplementedError in SandboxFactory. # The container IS the sandbox for devcontainer-instance, so NONE is # semantically correct until a dedicated container-snapshot strategy # is implemented. _default_strategy = SandboxStrategy.NONE ``` The comment acknowledges this is a deliberate temporary workaround because `SandboxFactory` has not implemented the `snapshot` strategy. This means the `snapshot` strategy is not actually implemented for devcontainers, and the handler silently falls back to `NONE`. ## Current Behavior - `DevcontainerHandler._default_strategy = SandboxStrategy.NONE` (line 155 of `devcontainer.py`) - The `snapshot` strategy is not implemented in `SandboxFactory`, causing a `NotImplementedError` if invoked - Container-level checkpoints and rollback are not available for devcontainer resources - The `create_sandbox()` method in `DevcontainerHandler` (line 638) delegates to the base class with `NONE` strategy, providing no isolation - The type registry definition (`_resource_registry_data.py` line 209) says `"sandbox_strategy": "snapshot"` but the handler contradicts this at runtime ## Expected Behavior Per ADR-043 §Sandbox Coordination, `devcontainer-instance` should use the `snapshot` sandbox strategy, which provides container commit/checkpoint for rollback: > A `devcontainer-instance` creates a sandbox domain (inherited from `container-instance`). The sandbox strategy is `snapshot` — container commit/checkpoint for rollback. Container-level checkpoints and rollback (as described in ADR-043 §Checkpoint Behavior) should be functional. Plans executing inside devcontainers should be able to roll back at the container level. ## Acceptance Criteria - `SandboxFactory` implements the `snapshot` strategy for container-based resources - `DevcontainerHandler._default_strategy` is changed from `SandboxStrategy.NONE` to `SandboxStrategy.SNAPSHOT` - The workaround comment referencing "F22/F25 fix" is removed - `create_sandbox()` in `DevcontainerHandler` correctly creates a snapshot-based sandbox (container commit/checkpoint) - Rollback via the snapshot strategy restores the container to its pre-plan state - The type registry definition and the handler are consistent: both specify `snapshot` - No `NotImplementedError` is raised when `SandboxFactory` is invoked with `snapshot` strategy for a devcontainer ## Supporting Information - **Code locations:** - `src/cleveragents/resource/handlers/devcontainer.py` line 155: `_default_strategy = SandboxStrategy.NONE` - `src/cleveragents/application/services/_resource_registry_data.py` line 209: `"sandbox_strategy": "snapshot"` - **ADR reference:** ADR-043 §Sandbox Coordination, §Checkpoint Behavior - **Impact:** Container-level checkpoints and rollback are non-functional for devcontainer resources; plans cannot be rolled back at the container level - **Note:** The comment in the code references "F22/F25 fix", indicating this was a deliberate temporary workaround. The root cause is that `SandboxFactory` needs to implement the `snapshot` strategy for containers. - **Discovered by:** UAT Testing agent during automated spec compliance review ## Subtasks - [ ] Implement `snapshot` strategy in `SandboxFactory` for container-based resources (container commit/checkpoint) - [ ] Update `DevcontainerHandler._default_strategy` from `SandboxStrategy.NONE` to `SandboxStrategy.SNAPSHOT` - [ ] Remove the F22/F25 workaround comment from `devcontainer.py` line 155 - [ ] Update `create_sandbox()` in `DevcontainerHandler` to correctly delegate to the snapshot strategy - [ ] Implement rollback via container restore from checkpoint/commit - [ ] Tests (unit): Add tests for `SandboxFactory` snapshot strategy with container resources - [ ] Tests (unit): Add tests for `DevcontainerHandler.create_sandbox()` using snapshot strategy - [ ] Tests (Behave): Add scenario verifying devcontainer sandbox uses snapshot strategy - [ ] Verify type registry definition and handler are consistent (both `snapshot`) - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - `SandboxFactory` implements the `snapshot` strategy for container resources without raising `NotImplementedError`. - `DevcontainerHandler._default_strategy` is `SandboxStrategy.SNAPSHOT` and the workaround comment is removed. - The type registry definition and handler are consistent — both specify `snapshot`. - Container-level checkpoint and rollback are functional for devcontainer resources. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - 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%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — The code contains an acknowledged workaround (F22/F25 fix comment) where SandboxStrategy.NONE is used because the snapshot strategy is not yet implemented in SandboxFactory. This is a known gap, not a regression.
  • Milestone: v3.6.0 — Container sandbox strategies are in scope for M7 (Advanced Concepts & Deferred Features).
  • Story Points: 8 — XL — Requires implementing the snapshot strategy in SandboxFactory (container commit/checkpoint), implementing rollback via container restore, updating the handler, and comprehensive testing. Significant complexity due to container-level state management.
  • MoSCoW: Could Have — While ADR-043 specifies snapshot as the sandbox strategy, the current NONE workaround is functional for basic devcontainer usage. Container-level checkpoint/rollback is an advanced feature that can be deferred if time is constrained.
  • Parent Epic: #398 (Post-MVP Resources)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — The code contains an acknowledged workaround (F22/F25 fix comment) where `SandboxStrategy.NONE` is used because the `snapshot` strategy is not yet implemented in `SandboxFactory`. This is a known gap, not a regression. - **Milestone**: v3.6.0 — Container sandbox strategies are in scope for M7 (Advanced Concepts & Deferred Features). - **Story Points**: 8 — XL — Requires implementing the `snapshot` strategy in `SandboxFactory` (container commit/checkpoint), implementing rollback via container restore, updating the handler, and comprehensive testing. Significant complexity due to container-level state management. - **MoSCoW**: Could Have — While ADR-043 specifies `snapshot` as the sandbox strategy, the current `NONE` workaround is functional for basic devcontainer usage. Container-level checkpoint/rollback is an advanced feature that can be deferred if time is constrained. - **Parent Epic**: #398 (Post-MVP Resources) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
freemo added this to the v3.6.0 milestone 2026-04-05 19:35:05 +00:00
Author
Owner

Closing as duplicate of #2130.

Both issues describe the same bug: DevcontainerHandler uses SandboxStrategy.NONE instead of the spec-required snapshot strategy. Issue #2130 is the established tracking issue (v3.7.0 milestone, Priority/High, State/Verified, MoSCoW/Must have). Please track this work in #2130.


Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: ca-backlog-groomer

Closing as duplicate of #2130. Both issues describe the same bug: `DevcontainerHandler` uses `SandboxStrategy.NONE` instead of the spec-required `snapshot` strategy. Issue #2130 is the established tracking issue (v3.7.0 milestone, `Priority/High`, `State/Verified`, `MoSCoW/Must have`). Please track this work in #2130. --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: ca-backlog-groomer
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.

Blocks
#398 Epic: Post-MVP Resources
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3544
No description provided.