feat(extensibility): implement Custom Sandbox Strategy Registration via SandboxStrategy Protocol #709

Merged
freemo merged 1 commit from feature/m6plus-custom-sandbox-strategy-registration into master 2026-03-16 23:06:03 +00:00
Owner

Summary

Implements the SandboxStrategy Protocol and config-driven registration mechanism for custom sandbox isolation strategies, enabling extensibility beyond the 6 built-in strategies (git_worktree, copy_on_write, filesystem_copy, overlay, transaction_rollback, none).

Closes #586

Changes

New modules in src/cleveragents/infrastructure/sandbox/

  • sandbox_strategy.pySandboxStrategy Protocol with all 9 methods (create, read, write, diff, commit, rollback, checkpoint, restore_checkpoint, cleanup) plus SandboxRef, Change, and DiffView domain models
  • strategy_adapter.py — Adapter layer refactoring existing built-in strategies to implement the SandboxStrategy Protocol
  • strategy_registry.py — Config-driven custom strategy registration supporting:
    • sandbox.custom_strategies.<name>.module + .class configuration
    • Plugin resolution via module:ClassName pattern
    • Protocol validation before registration (verifies all 9 methods)
    • Resource type sandbox_strategy field resolution for both built-in and custom strategies

Test files

  • features/extensibility/custom_sandbox_strategy.feature + step definitions — BDD tests for Protocol compliance checking and custom strategy registration lifecycle
  • robot/ integration test — Register a custom strategy, create sandbox, verify full lifecycle

Quality Checks

  • nox -e typecheck — 0 Pyright errors
  • nox -e lint — all checks passed
  • nox -e format — all files unchanged
## Summary Implements the `SandboxStrategy` Protocol and config-driven registration mechanism for custom sandbox isolation strategies, enabling extensibility beyond the 6 built-in strategies (git_worktree, copy_on_write, filesystem_copy, overlay, transaction_rollback, none). Closes #586 ## Changes ### New modules in `src/cleveragents/infrastructure/sandbox/` - **`sandbox_strategy.py`** — `SandboxStrategy` Protocol with all 9 methods (`create`, `read`, `write`, `diff`, `commit`, `rollback`, `checkpoint`, `restore_checkpoint`, `cleanup`) plus `SandboxRef`, `Change`, and `DiffView` domain models - **`strategy_adapter.py`** — Adapter layer refactoring existing built-in strategies to implement the `SandboxStrategy` Protocol - **`strategy_registry.py`** — Config-driven custom strategy registration supporting: - `sandbox.custom_strategies.<name>.module` + `.class` configuration - Plugin resolution via `module:ClassName` pattern - Protocol validation before registration (verifies all 9 methods) - Resource type `sandbox_strategy` field resolution for both built-in and custom strategies ### Test files - `features/extensibility/custom_sandbox_strategy.feature` + step definitions — BDD tests for Protocol compliance checking and custom strategy registration lifecycle - `robot/` integration test — Register a custom strategy, create sandbox, verify full lifecycle ## Quality Checks - `nox -e typecheck` — 0 Pyright errors - `nox -e lint` — all checks passed - `nox -e format` — all files unchanged
freemo added this to the v3.6.0 milestone 2026-03-12 01:31:20 +00:00
freemo self-assigned this 2026-03-12 20:33:28 +00:00
freemo left a comment

PM Review — Day 32

Status: COMMENT — Needs peer code review before approval

Summary

Custom Sandbox Strategy Registration via SandboxStrategy Protocol by @freemo. Implements extensibility for sandbox isolation strategies beyond the 6 built-in ones. Mergeable, no conflicts.

Process Compliance

  • PR body: Adequate — summary, module descriptions, quality checks. Missing: diff coverage table, spec reference lines, CHANGELOG entry.
  • Closes keyword: Closes #586 — correct.
  • Labels: Added (Priority/Medium, MoSCoW/Should have, Points/8, State/In Progress).
  • Milestone: v3.6.0 (M7) — correct.
  • Assignee: @freemo — correct.

Technical Assessment (from PR body)

  • SandboxStrategy Protocol with 9 methods + 3 domain models.
  • Config-driven registration with module:ClassName pattern.
  • Protocol validation before registration.
  • BDD + Robot tests.
  • Pyright 0 errors, lint passed, format clean.

Action Required

  • @CoreRasurae or @brent.edwards: Please perform a code review. Protocol design and plugin registration patterns benefit from a second pair of eyes on the API surface. Mergeable, M7 (due Mar 28).

Labels Added

  • Priority/Medium, MoSCoW/Should have, Points/8, State/In Progress
## PM Review — Day 32 ### Status: COMMENT — Needs peer code review before approval ### Summary Custom Sandbox Strategy Registration via `SandboxStrategy` Protocol by @freemo. Implements extensibility for sandbox isolation strategies beyond the 6 built-in ones. Mergeable, no conflicts. ### Process Compliance - **PR body**: Adequate — summary, module descriptions, quality checks. Missing: diff coverage table, spec reference lines, CHANGELOG entry. - **Closes keyword**: `Closes #586` — correct. - **Labels**: Added (Priority/Medium, MoSCoW/Should have, Points/8, State/In Progress). - **Milestone**: v3.6.0 (M7) — correct. - **Assignee**: @freemo — correct. ### Technical Assessment (from PR body) - `SandboxStrategy` Protocol with 9 methods + 3 domain models. - Config-driven registration with `module:ClassName` pattern. - Protocol validation before registration. - BDD + Robot tests. - Pyright 0 errors, lint passed, format clean. ### Action Required - **@CoreRasurae or @brent.edwards**: Please perform a code review. Protocol design and plugin registration patterns benefit from a second pair of eyes on the API surface. Mergeable, M7 (due Mar 28). ### Labels Added - Priority/Medium, MoSCoW/Should have, Points/8, State/In Progress
Author
Owner

PM Review — Day 34

Status: Mergeable, 0 reviews, M7 (v3.6.0), Priority/Medium, Points/8
Author: @freemo

Custom Sandbox Strategy Registration via SandboxStrategy Protocol. M7 due March 28 — medium urgency.

Action Items

Who Action Deadline
@hamza.khyari Peer review Day 38
## PM Review — Day 34 **Status**: Mergeable, 0 reviews, M7 (v3.6.0), Priority/Medium, Points/8 **Author**: @freemo Custom Sandbox Strategy Registration via SandboxStrategy Protocol. M7 due March 28 — medium urgency. ### Action Items | Who | Action | Deadline | |-----|--------|----------| | @hamza.khyari | **Peer review** | Day 38 |
freemo left a comment

PM Day 36: Custom Sandbox Strategy Registration. Closes #586. M7 scope. Reviewer: @hamza.khyari (sandbox domain).

PM Day 36: Custom Sandbox Strategy Registration. Closes #586. M7 scope. Reviewer: @hamza.khyari (sandbox domain).
freemo force-pushed feature/m6plus-custom-sandbox-strategy-registration from 9065b7ba1a
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 35s
CI / typecheck (pull_request) Successful in 42s
CI / unit_tests (pull_request) Successful in 3m9s
CI / integration_tests (pull_request) Successful in 3m28s
CI / docker (pull_request) Successful in 40s
CI / coverage (pull_request) Successful in 6m5s
CI / benchmark-regression (pull_request) Successful in 37m11s
to 2688c85769
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 19s
CI / lint (pull_request) Successful in 23s
CI / quality (pull_request) Successful in 28s
CI / security (pull_request) Successful in 54s
CI / typecheck (pull_request) Successful in 1m25s
CI / e2e_tests (pull_request) Successful in 2m33s
CI / unit_tests (pull_request) Successful in 3m4s
CI / integration_tests (pull_request) Successful in 3m33s
CI / docker (pull_request) Successful in 1m7s
CI / coverage (pull_request) Successful in 5m50s
CI / lint (push) Successful in 18s
CI / build (push) Successful in 33s
CI / quality (push) Successful in 47s
CI / typecheck (push) Successful in 49s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 52s
CI / e2e_tests (push) Successful in 2m9s
CI / unit_tests (push) Successful in 3m32s
CI / integration_tests (push) Successful in 3m41s
CI / docker (push) Successful in 56s
CI / coverage (push) Successful in 6m10s
CI / benchmark-publish (push) Has been cancelled
CI / benchmark-regression (pull_request) Successful in 40m21s
2026-03-16 22:50:29 +00:00
Compare
freemo merged commit 2688c85769 into master 2026-03-16 23:06:03 +00:00
freemo deleted branch feature/m6plus-custom-sandbox-strategy-registration 2026-03-16 23:06:03 +00:00
Sign in to join this conversation.
No reviewers
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!709
No description provided.