UAT: --execution-environment flag accepts only enum values (host/container) — spec requires resource name like local/my-devcontainer #2473

Open
opened 2026-04-03 18:36:37 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/cli-execution-environment-resource-name
  • Commit Message: fix(cli): accept resource name for --execution-environment flag instead of enum
  • Milestone: v3.6.0
  • Parent Epic: #825

Background

Both agents project context set --execution-environment and agents plan use --execution-environment validate the value against the ExecutionEnvironment enum (values: host, container, container_ref). However, the spec requires the flag to accept a resource name (e.g., local/my-devcontainer).

Spec reference (line 3793):

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

Spec reference (line 12504):

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

Code locations:

  • src/cleveragents/cli/commands/project_context.py lines 694–702: validates execution_environment against ExecutionEnvironment enum
  • src/cleveragents/cli/commands/plan.py lines 1648–1655: validates execution_environment against ExecutionEnvironment enum

Actual behavior: Passing local/my-devcontainer as --execution-environment raises a ValueError because it is not a valid ExecutionEnvironment enum value.

Expected behavior: The flag should accept a resource name (like local/my-devcontainer) and store it as a container reference. The ExecutionEnvironmentResolver.parse_container_ref() method already supports container:// prefix format, but the CLI does not expose this.

Steps to reproduce:

  1. Register a devcontainer resource: agents resource add devcontainer-instance local/my-dc --path /project
  2. Try: agents project context set my-project --execution-environment local/my-dc
  3. Observe: Error "Invalid execution environment: local/my-dc. Valid values: host, container, container_ref"

Subtasks

  • Remove ExecutionEnvironment enum validation from --execution-environment flag in project_context.py (lines 694–702)
  • Remove ExecutionEnvironment enum validation from --execution-environment flag in plan.py (lines 1648–1655)
  • Update both CLI handlers to accept a free-form resource name string and resolve it via ExecutionEnvironmentResolver.parse_container_ref() or equivalent
  • Add argument validation: verify the supplied resource name refers to a registered container-instance or devcontainer-instance resource; raise a user-friendly error if not found
  • Update CLI help text for --execution-environment in both commands to read RESOURCE_NAME (not enum choices)
  • Tests (Behave): Add scenarios for project context set --execution-environment <resource-name> with valid and invalid resource names
  • Tests (Behave): Add scenarios for plan use --execution-environment <resource-name> with valid and invalid resource names
  • Tests (Robot): Add integration test exercising the full flow (register resource → set execution environment → verify stored value)
  • 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.
  • 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-uat-tester

## Metadata - **Branch**: `fix/cli-execution-environment-resource-name` - **Commit Message**: `fix(cli): accept resource name for --execution-environment flag instead of enum` - **Milestone**: v3.6.0 - **Parent Epic**: #825 ## Background Both `agents project context set --execution-environment` and `agents plan use --execution-environment` validate the value against the `ExecutionEnvironment` enum (values: `host`, `container`, `container_ref`). However, the spec requires the flag to accept a **resource name** (e.g., `local/my-devcontainer`). **Spec reference (line 3793):** > `--execution-environment RESOURCE_NAME`: Name of a `container-instance` or `devcontainer-instance` resource to use as the default execution environment for this project. **Spec reference (line 12504):** > `--execution-environment RESOURCE_NAME`: Name of a `container-instance` or `devcontainer-instance` resource to use as the execution environment for this plan. **Code locations:** - `src/cleveragents/cli/commands/project_context.py` lines 694–702: validates `execution_environment` against `ExecutionEnvironment` enum - `src/cleveragents/cli/commands/plan.py` lines 1648–1655: validates `execution_environment` against `ExecutionEnvironment` enum **Actual behavior:** Passing `local/my-devcontainer` as `--execution-environment` raises a `ValueError` because it is not a valid `ExecutionEnvironment` enum value. **Expected behavior:** The flag should accept a resource name (like `local/my-devcontainer`) and store it as a container reference. The `ExecutionEnvironmentResolver.parse_container_ref()` method already supports `container://` prefix format, but the CLI does not expose this. **Steps to reproduce:** 1. Register a devcontainer resource: `agents resource add devcontainer-instance local/my-dc --path /project` 2. Try: `agents project context set my-project --execution-environment local/my-dc` 3. Observe: Error `"Invalid execution environment: local/my-dc. Valid values: host, container, container_ref"` ## Subtasks - [ ] Remove `ExecutionEnvironment` enum validation from `--execution-environment` flag in `project_context.py` (lines 694–702) - [ ] Remove `ExecutionEnvironment` enum validation from `--execution-environment` flag in `plan.py` (lines 1648–1655) - [ ] Update both CLI handlers to accept a free-form resource name string and resolve it via `ExecutionEnvironmentResolver.parse_container_ref()` or equivalent - [ ] Add argument validation: verify the supplied resource name refers to a registered `container-instance` or `devcontainer-instance` resource; raise a user-friendly error if not found - [ ] Update CLI help text for `--execution-environment` in both commands to read `RESOURCE_NAME` (not enum choices) - [ ] Tests (Behave): Add scenarios for `project context set --execution-environment <resource-name>` with valid and invalid resource names - [ ] Tests (Behave): Add scenarios for `plan use --execution-environment <resource-name>` with valid and invalid resource names - [ ] Tests (Robot): Add integration test exercising the full flow (register resource → set execution environment → verify stored value) - [ ] 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. - 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-uat-tester
freemo added this to the v3.6.0 milestone 2026-04-03 18:37:24 +00:00
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • MoSCoW: Should Have — Spec compliance or quality improvement that should be included in the milestone.

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

Issue triaged by project owner: - **State**: Verified - **MoSCoW**: Should Have — Spec compliance or quality improvement that should be included in the milestone. --- **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
Reference
cleveragents/cleveragents-core#2473
No description provided.