UAT: agents plan use --execution-environment accepts enum values (host/container/container_ref) instead of spec-required resource names #3517

Open
opened 2026-04-05 18:48:22 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/plan-use-execution-environment-resource-name
  • Commit Message: fix(cli): resolve --execution-environment to resource name instead of enum value
  • Milestone: Backlog (no milestone assigned)
  • Parent Epic: #397

Background and Context

Code-level analysis of src/cleveragents/cli/commands/plan.py against docs/specification.md §"agents plan use" and ADR-043 revealed a discrepancy between the CLI implementation and the specification for the --execution-environment option of the agents plan use command.

The --execution-environment option currently validates its value against the ExecutionEnvironment enum (host, container, container_ref) rather than accepting a resource name (e.g., local/my-devcontainer, my-container-instance) as specified.

Current Behavior

The implementation in use_action() (lines 1643–1656) and execute_plan() (lines 1816–1832) of src/cleveragents/cli/commands/plan.py validates the option value against the ExecutionEnvironment enum:

ExecutionEnvironment(execution_environment.lower())

Valid values accepted: host, container, container_ref

If a resource name like local/my-devcontainer is passed, the command fails:

Invalid execution environment: local/my-devcontainer. Valid values: host, container, container_ref

Steps to Reproduce:

  1. Register a devcontainer resource: agents resource add devcontainer-instance local/my-devcontainer
  2. Attempt to use it: agents plan use local/my-action my-project --execution-environment local/my-devcontainer
  3. Observe: Error "Invalid execution environment: local/my-devcontainer. Valid values: host, container, container_ref"

Expected Behavior

Per docs/specification.md §"agents plan use":

--execution-environment RESOURCE_NAME: Name of a container-instance or devcontainer-instance resource to use as the execution environment for this plan.

The option should accept a resource name (e.g., local/my-devcontainer, my-container-instance) — the name of a registered container-instance or devcontainer-instance resource — and resolve it to the appropriate execution context.

Example (per spec):

agents plan use local/code-review my-project --execution-environment local/my-devcontainer

Root Cause

The ExecutionEnvironment enum models the type of execution environment (host/container/container_ref), not the name of a specific resource. The spec intends --execution-environment to accept a resource name that is then resolved to the appropriate container resource. The implementation incorrectly uses the enum type as the CLI value instead.

Affected code locations:

  • src/cleveragents/cli/commands/plan.py, lines 1643–1656 — validation in use_action()
  • src/cleveragents/cli/commands/plan.py, lines 1816–1832 — same validation in execute_plan()
  • src/cleveragents/domain/models/core/plan.py, lines ~119–135 — ExecutionEnvironment enum definition

Subtasks

  • Update use_action() in plan.py to accept a resource name string for --execution-environment instead of validating against ExecutionEnvironment enum
  • Update execute_plan() in plan.py with the same fix
  • Implement resource name resolution logic: look up the named container-instance or devcontainer-instance resource and derive the execution environment type from it
  • Update CLI help text for --execution-environment to reflect RESOURCE_NAME as the expected value
  • Update or add Behave scenarios covering agents plan use --execution-environment <resource-name> with valid and invalid resource names
  • Update or add Robot Framework integration tests for the corrected option behaviour
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions) and fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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%.

Backlog note: This issue was discovered during autonomous operation on milestone v3.5.0. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `fix/plan-use-execution-environment-resource-name` - **Commit Message**: `fix(cli): resolve --execution-environment to resource name instead of enum value` - **Milestone**: Backlog (no milestone assigned) - **Parent Epic**: #397 ## Background and Context Code-level analysis of `src/cleveragents/cli/commands/plan.py` against `docs/specification.md` §"agents plan use" and ADR-043 revealed a discrepancy between the CLI implementation and the specification for the `--execution-environment` option of the `agents plan use` command. The `--execution-environment` option currently validates its value against the `ExecutionEnvironment` enum (`host`, `container`, `container_ref`) rather than accepting a **resource name** (e.g., `local/my-devcontainer`, `my-container-instance`) as specified. ## Current Behavior The implementation in `use_action()` (lines 1643–1656) and `execute_plan()` (lines 1816–1832) of `src/cleveragents/cli/commands/plan.py` validates the option value against the `ExecutionEnvironment` enum: ```python ExecutionEnvironment(execution_environment.lower()) ``` Valid values accepted: `host`, `container`, `container_ref` If a resource name like `local/my-devcontainer` is passed, the command fails: ``` Invalid execution environment: local/my-devcontainer. Valid values: host, container, container_ref ``` **Steps to Reproduce:** 1. Register a devcontainer resource: `agents resource add devcontainer-instance local/my-devcontainer` 2. Attempt to use it: `agents plan use local/my-action my-project --execution-environment local/my-devcontainer` 3. Observe: Error "Invalid execution environment: local/my-devcontainer. Valid values: host, container, container_ref" ## Expected Behavior Per `docs/specification.md` §"agents plan use": ``` --execution-environment RESOURCE_NAME: Name of a container-instance or devcontainer-instance resource to use as the execution environment for this plan. ``` The option should accept a **resource name** (e.g., `local/my-devcontainer`, `my-container-instance`) — the name of a registered `container-instance` or `devcontainer-instance` resource — and resolve it to the appropriate execution context. Example (per spec): ``` agents plan use local/code-review my-project --execution-environment local/my-devcontainer ``` ## Root Cause The `ExecutionEnvironment` enum models the *type* of execution environment (host/container/container_ref), not the *name* of a specific resource. The spec intends `--execution-environment` to accept a resource name that is then resolved to the appropriate container resource. The implementation incorrectly uses the enum type as the CLI value instead. **Affected code locations:** - `src/cleveragents/cli/commands/plan.py`, lines 1643–1656 — validation in `use_action()` - `src/cleveragents/cli/commands/plan.py`, lines 1816–1832 — same validation in `execute_plan()` - `src/cleveragents/domain/models/core/plan.py`, lines ~119–135 — `ExecutionEnvironment` enum definition ## Subtasks - [ ] Update `use_action()` in `plan.py` to accept a resource name string for `--execution-environment` instead of validating against `ExecutionEnvironment` enum - [ ] Update `execute_plan()` in `plan.py` with the same fix - [ ] Implement resource name resolution logic: look up the named `container-instance` or `devcontainer-instance` resource and derive the execution environment type from it - [ ] Update CLI help text for `--execution-environment` to reflect `RESOURCE_NAME` as the expected value - [ ] Update or add Behave scenarios covering `agents plan use --execution-environment <resource-name>` with valid and invalid resource names - [ ] Update or add Robot Framework integration tests for the corrected option behaviour - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions) and fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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%. > **Backlog note:** This issue was discovered during autonomous operation on milestone v3.5.0. It does not block milestone completion and has been placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
freemo added this to the v3.7.0 milestone 2026-04-05 20:07:09 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Low — --execution-environment accepts enum values instead of resource names. The spec requires resource names (e.g., local/my-devcontainer), but the implementation validates against the ExecutionEnvironment enum.
  • Milestone: v3.7.0
  • Story Points: 2 — S — Update validation logic in two functions to accept resource names and implement resource lookup.
  • MoSCoW: Could Have — Container execution environment support is an advanced feature. The basic host execution mode works. Resource-name-based environment selection can be deferred.
  • Parent Epic: #397 (dependency link already exists)

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

Issue triaged by project owner: - **State**: Verified - **Priority**: Low — `--execution-environment` accepts enum values instead of resource names. The spec requires resource names (e.g., `local/my-devcontainer`), but the implementation validates against the `ExecutionEnvironment` enum. - **Milestone**: v3.7.0 - **Story Points**: 2 — S — Update validation logic in two functions to accept resource names and implement resource lookup. - **MoSCoW**: Could Have — Container execution environment support is an advanced feature. The basic `host` execution mode works. Resource-name-based environment selection can be deferred. - **Parent Epic**: #397 (dependency link already exists) --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: ca-project-owner
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
#397 Epic: Server & Autonomy Infrastructure
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3517
No description provided.