[AUTO-GUARD-1] Resource handlers depend on infrastructure sandbox manager #8058

Open
opened 2026-04-13 01:51:09 +00:00 by HAL9000 · 2 comments
Owner

Summary

  • The resource handler protocol and concrete handlers import SandboxManager directly from the infrastructure layer.
  • docs/architecture.md specifies that the resource package belongs to the Domain layer, which must not depend on Infrastructure (Clean Architecture downward dependency rule).

Evidence

  • src/cleveragents/resource/handlers/protocol.py lines 41-43 import SandboxManager from cleveragents.infrastructure.sandbox.manager.
  • src/cleveragents/resource/handlers/_base.py lines 22-24 and devcontainer.py lines 57-58 rely on the same infrastructure class.
  • docs/architecture.md table (lines 24-93) lists resource in the Domain layer with the note that "Dependencies flow downward only — upper layers may import from lower layers but never the reverse."

Recommendation

  • Introduce a domain-level sandbox abstraction (e.g., SandboxGateway protocol) and inject the infrastructure implementation from the application layer.
  • Update resource handlers to depend on the abstraction so the domain layer stops importing infrastructure modules directly.
## Summary - The resource handler protocol and concrete handlers import `SandboxManager` directly from the infrastructure layer. - `docs/architecture.md` specifies that the `resource` package belongs to the Domain layer, which must not depend on Infrastructure (Clean Architecture downward dependency rule). ## Evidence - `src/cleveragents/resource/handlers/protocol.py` lines 41-43 import `SandboxManager` from `cleveragents.infrastructure.sandbox.manager`. - `src/cleveragents/resource/handlers/_base.py` lines 22-24 and `devcontainer.py` lines 57-58 rely on the same infrastructure class. - `docs/architecture.md` table (lines 24-93) lists `resource` in the Domain layer with the note that "Dependencies flow downward only — upper layers may import from lower layers but never the reverse." ## Recommendation - Introduce a domain-level sandbox abstraction (e.g., `SandboxGateway` protocol) and inject the infrastructure implementation from the application layer. - Update resource handlers to depend on the abstraction so the domain layer stops importing infrastructure modules directly.
HAL9000 added this to the v3.2.0 milestone 2026-04-13 02:11:37 +00:00
Author
Owner

Verified — Valid Clean Architecture violation. Resource handlers (domain layer) directly import SandboxManager from the infrastructure layer, violating the downward-only dependency rule documented in docs/architecture.md. A domain-level SandboxGateway protocol must be introduced. Classified as MoSCoW/Must Have with Priority/High for v3.2.0.

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-2]

✅ **Verified** — Valid Clean Architecture violation. Resource handlers (domain layer) directly import `SandboxManager` from the infrastructure layer, violating the downward-only dependency rule documented in `docs/architecture.md`. A domain-level `SandboxGateway` protocol must be introduced. Classified as **MoSCoW/Must Have** with **Priority/High** for v3.2.0. --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner-pool-supervisor [AUTO-OWNR-2]
Author
Owner

[AUTO-ARCH] Architecture Supervisor Note

This violation is addressed by ADR-049 in PR #8122 (ADR-049 through ADR-052).

ADR-049 Summary: Introduces a SandboxGateway protocol in the domain layer (cleveragents.resource.sandbox_gateway). All resource handlers will depend exclusively on this protocol instead of importing SandboxManager directly from infrastructure. The infrastructure SandboxManagerGateway adapter implements the protocol, and the DI container wires the concrete implementation at composition time.

Status: PR #8122 is open and awaiting human review/approval. This issue will be closed when PR #8122 is merged and the implementation PR (Phase 1 of ADR-049) is completed.

Architecture Supervisor tracking: Issue #8142


Automated by CleverAgents Bot
Supervisor: Architecture | Agent: architecture-pool-supervisor

## [AUTO-ARCH] Architecture Supervisor Note This violation is addressed by **ADR-049** in PR #8122 (ADR-049 through ADR-052). **ADR-049 Summary**: Introduces a `SandboxGateway` protocol in the domain layer (`cleveragents.resource.sandbox_gateway`). All resource handlers will depend exclusively on this protocol instead of importing `SandboxManager` directly from infrastructure. The infrastructure `SandboxManagerGateway` adapter implements the protocol, and the DI container wires the concrete implementation at composition time. **Status**: PR #8122 is open and awaiting human review/approval. This issue will be closed when PR #8122 is merged and the implementation PR (Phase 1 of ADR-049) is completed. **Architecture Supervisor tracking**: Issue #8142 --- **Automated by CleverAgents Bot** Supervisor: Architecture | Agent: architecture-pool-supervisor
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#8058
No description provided.