feat(execution): add execution environment routing #532

Merged
freemo merged 1 commit from feature/m6-execution-env-routing into master 2026-03-03 19:54:13 +00:00
Owner

Summary

Implements execution environment routing as specified in #512.

  • Added ExecutionEnvironment enum (host, container) as a StrEnum to domain models
  • Added execution_environment field to Plan and ContextConfig models
  • Created ExecutionEnvironmentResolver service with priority chain: tool-level > plan-level > project-level > default (host)
  • Wired the ToolRunner to check execution_environment before execution and route to container handler when container is selected
  • Added --execution-environment flag to agents plan use and agents plan execute CLI commands
  • Added execution_environment support to agents project context set CLI command
  • When container is selected but no container resource is available, raises ContainerUnavailableError with actionable message

Quality Gates

Gate Status
nox -s lint PASSED
nox -s typecheck PASSED (0 errors)
nox -s unit_tests PASSED (2 pre-existing failures in cli_core.feature, 0 new)
nox -s integration_tests Pre-existing failures only
nox -s coverage_report 97.1% (threshold: 97%)
nox -s security_scan PASSED
nox -s dead_code PASSED
nox -s docs PASSED
nox -s build PASSED

Test Coverage

  • 25 BDD scenarios in features/execution_environment.feature (71 steps, all passing)
  • 5 Robot Framework smoke tests in robot/execution_environment.robot
  • ASV benchmarks in benchmarks/execution_environment_bench.py
  • execution_environment_resolver.py: 100% coverage

Files Changed

New Files

  • src/cleveragents/application/services/execution_environment_resolver.py — Resolver service (175 lines)
  • features/execution_environment.feature — BDD scenarios
  • features/steps/execution_environment_steps.py — Step definitions
  • robot/execution_environment.robot — Robot Framework tests
  • robot/helper_execution_environment.py — Robot helper
  • benchmarks/execution_environment_bench.py — ASV benchmarks

Modified Files

  • src/cleveragents/domain/models/core/plan.pyExecutionEnvironment enum + field on Plan
  • src/cleveragents/domain/models/core/project.py — Field on ContextConfig
  • src/cleveragents/tool/runner.py — Resolver wiring + container routing
  • src/cleveragents/cli/commands/plan.py--execution-environment flag
  • src/cleveragents/cli/commands/project_context.py--execution-environment flag
  • src/cleveragents/application/container.py — DI registration
  • src/cleveragents/domain/models/core/__init__.py — Export
  • src/cleveragents/application/services/__init__.py — Export
  • vulture_whitelist.py — Whitelist entries
  • CHANGELOG.md — Release note

Closes #512

## Summary Implements execution environment routing as specified in #512. - Added `ExecutionEnvironment` enum (`host`, `container`) as a `StrEnum` to domain models - Added `execution_environment` field to `Plan` and `ContextConfig` models - Created `ExecutionEnvironmentResolver` service with priority chain: tool-level > plan-level > project-level > default (host) - Wired the `ToolRunner` to check `execution_environment` before execution and route to container handler when container is selected - Added `--execution-environment` flag to `agents plan use` and `agents plan execute` CLI commands - Added `execution_environment` support to `agents project context set` CLI command - When container is selected but no container resource is available, raises `ContainerUnavailableError` with actionable message ## Quality Gates | Gate | Status | |------|--------| | `nox -s lint` | PASSED | | `nox -s typecheck` | PASSED (0 errors) | | `nox -s unit_tests` | PASSED (2 pre-existing failures in cli_core.feature, 0 new) | | `nox -s integration_tests` | Pre-existing failures only | | `nox -s coverage_report` | **97.1%** (threshold: 97%) | | `nox -s security_scan` | PASSED | | `nox -s dead_code` | PASSED | | `nox -s docs` | PASSED | | `nox -s build` | PASSED | ## Test Coverage - **25 BDD scenarios** in `features/execution_environment.feature` (71 steps, all passing) - **5 Robot Framework smoke tests** in `robot/execution_environment.robot` - **ASV benchmarks** in `benchmarks/execution_environment_bench.py` - `execution_environment_resolver.py`: **100% coverage** ## Files Changed ### New Files - `src/cleveragents/application/services/execution_environment_resolver.py` — Resolver service (175 lines) - `features/execution_environment.feature` — BDD scenarios - `features/steps/execution_environment_steps.py` — Step definitions - `robot/execution_environment.robot` — Robot Framework tests - `robot/helper_execution_environment.py` — Robot helper - `benchmarks/execution_environment_bench.py` — ASV benchmarks ### Modified Files - `src/cleveragents/domain/models/core/plan.py` — `ExecutionEnvironment` enum + field on `Plan` - `src/cleveragents/domain/models/core/project.py` — Field on `ContextConfig` - `src/cleveragents/tool/runner.py` — Resolver wiring + container routing - `src/cleveragents/cli/commands/plan.py` — `--execution-environment` flag - `src/cleveragents/cli/commands/project_context.py` — `--execution-environment` flag - `src/cleveragents/application/container.py` — DI registration - `src/cleveragents/domain/models/core/__init__.py` — Export - `src/cleveragents/application/services/__init__.py` — Export - `vulture_whitelist.py` — Whitelist entries - `CHANGELOG.md` — Release note Closes #512
freemo force-pushed feature/m6-execution-env-routing from e945fad2a3
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 14s
CI / quality (pull_request) Successful in 16s
CI / security (pull_request) Successful in 33s
CI / typecheck (pull_request) Successful in 33s
CI / unit_tests (pull_request) Successful in 3m17s
CI / docker (pull_request) Successful in 41s
CI / integration_tests (pull_request) Successful in 4m5s
CI / coverage (pull_request) Successful in 3m58s
CI / benchmark-regression (pull_request) Successful in 24m47s
to ad5f737721
All checks were successful
CI / lint (pull_request) Successful in 16s
CI / quality (pull_request) Successful in 25s
CI / typecheck (pull_request) Successful in 35s
CI / benchmark-publish (pull_request) Has been skipped
CI / security (pull_request) Successful in 38s
CI / build (pull_request) Successful in 21s
CI / unit_tests (pull_request) Successful in 3m42s
CI / docker (pull_request) Successful in 42s
CI / coverage (pull_request) Successful in 4m9s
CI / integration_tests (pull_request) Successful in 4m33s
CI / lint (push) Successful in 13s
CI / quality (push) Successful in 18s
CI / typecheck (push) Successful in 34s
CI / build (push) Successful in 19s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 48s
CI / integration_tests (push) Successful in 2m55s
CI / unit_tests (push) Successful in 3m10s
CI / docker (push) Successful in 59s
CI / coverage (push) Successful in 4m46s
CI / benchmark-publish (push) Successful in 14m18s
CI / benchmark-regression (pull_request) Successful in 26m2s
2026-03-03 19:49:11 +00:00
Compare
freemo scheduled this pull request to auto merge when all checks succeed 2026-03-03 19:49:25 +00:00
freemo merged commit ad5f737721 into master 2026-03-03 19:54:13 +00:00
freemo deleted branch feature/m6-execution-env-routing 2026-03-03 19:54:13 +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.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!532
No description provided.