UAT: agents project context set --execution-environment validates against ExecutionEnvironment enum instead of accepting a resource name #3871

Open
opened 2026-04-06 07:03:51 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/project-context-exec-env-resource-name
  • Commit Message: fix(project): accept resource name in --execution-environment for project context set
  • Milestone: Backlog
  • Parent Epic: #398

Background and Context

During UAT testing of the agents project context set CLI command, a spec deviation was discovered in src/cleveragents/cli/commands/project_context.py. The --execution-environment flag incorrectly validates its value against the ExecutionEnvironment enum (which only accepts host, container, container_ref) instead of accepting a resource name string as required by the specification.

Current Behavior

The code at the context_set function in src/cleveragents/cli/commands/project_context.py, inside the if execution_environment is not None: block, performs the following validation:

ExecutionEnvironment(execution_environment.lower())

This causes any resource name (e.g., local/my-devcontainer) to be rejected with:

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

Steps to reproduce:

  1. Create a project: agents project create my-project
  2. Register a devcontainer resource: agents resource add devcontainer-instance my-devcontainer
  3. Try to set execution environment: agents project context set --execution-environment local/my-devcontainer my-project
  4. Observe error: "Invalid execution environment: local/my-devcontainer"

Expected Behavior

Per the specification, the --execution-environment flag for agents project context set should accept a RESOURCE_NAME — the name of a container-instance or devcontainer-instance resource registered in the Resource Registry (e.g., local/my-devcontainer). The spec states: "Name of a container-instance or devcontainer-instance resource to use as the default execution environment for this project."

The value should be accepted as any string (a resource name) and stored as-is in the project's context policy JSON blob. The ExecutionEnvironment enum validation is appropriate for plan-level execution environment (where host/container are valid), but not for project-level context set where a resource name is expected.

Acceptance Criteria

  • agents project context set --execution-environment local/my-devcontainer my-project succeeds without error
  • The resource name is stored as-is in the project's context policy JSON blob
  • The ExecutionEnvironment enum validation is removed from the context_set function's --execution-environment handling
  • Existing plan-level ExecutionEnvironment enum validation is unaffected
  • All existing tests continue to pass

Subtasks

  • Remove ExecutionEnvironment(execution_environment.lower()) enum validation from context_set in src/cleveragents/cli/commands/project_context.py
  • Accept --execution-environment as a plain string (resource name) and store it directly in the project context policy
  • Tests (Behave): Add/update BDD scenario for agents project context set --execution-environment <resource-name> accepting a resource name
  • Tests (Behave): Add scenario reproducing the bug (TDD issue-capture: @tdd_expected_fail until fix is in)
  • Tests (Robot): Add/update integration test verifying end-to-end resource name acceptance
  • 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.
  • The ExecutionEnvironment enum validation is removed from the project-level context_set handler; --execution-environment accepts any resource name string.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (fix(project): accept resource name in --execution-environment for project context set), followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch fix/project-context-exec-env-resource-name.
  • 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.6.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/project-context-exec-env-resource-name` - **Commit Message**: `fix(project): accept resource name in --execution-environment for project context set` - **Milestone**: Backlog - **Parent Epic**: #398 ## Background and Context During UAT testing of the `agents project context set` CLI command, a spec deviation was discovered in `src/cleveragents/cli/commands/project_context.py`. The `--execution-environment` flag incorrectly validates its value against the `ExecutionEnvironment` enum (which only accepts `host`, `container`, `container_ref`) instead of accepting a resource name string as required by the specification. ## Current Behavior The code at the `context_set` function in `src/cleveragents/cli/commands/project_context.py`, inside the `if execution_environment is not None:` block, performs the following validation: ```python ExecutionEnvironment(execution_environment.lower()) ``` This causes any resource name (e.g., `local/my-devcontainer`) to be rejected with: > "Invalid execution environment: local/my-devcontainer. Valid values: host, container, container_ref" **Steps to reproduce:** 1. Create a project: `agents project create my-project` 2. Register a devcontainer resource: `agents resource add devcontainer-instance my-devcontainer` 3. Try to set execution environment: `agents project context set --execution-environment local/my-devcontainer my-project` 4. Observe error: `"Invalid execution environment: local/my-devcontainer"` ## Expected Behavior Per the specification, the `--execution-environment` flag for `agents project context set` should accept a `RESOURCE_NAME` — the name of a `container-instance` or `devcontainer-instance` resource registered in the Resource Registry (e.g., `local/my-devcontainer`). The spec states: *"Name of a `container-instance` or `devcontainer-instance` resource to use as the default execution environment for this project."* The value should be accepted as any string (a resource name) and stored as-is in the project's context policy JSON blob. The `ExecutionEnvironment` enum validation is appropriate for plan-level execution environment (where `host`/`container` are valid), but **not** for project-level context set where a resource name is expected. ## Acceptance Criteria - [ ] `agents project context set --execution-environment local/my-devcontainer my-project` succeeds without error - [ ] The resource name is stored as-is in the project's context policy JSON blob - [ ] The `ExecutionEnvironment` enum validation is removed from the `context_set` function's `--execution-environment` handling - [ ] Existing plan-level `ExecutionEnvironment` enum validation is unaffected - [ ] All existing tests continue to pass ## Subtasks - [ ] Remove `ExecutionEnvironment(execution_environment.lower())` enum validation from `context_set` in `src/cleveragents/cli/commands/project_context.py` - [ ] Accept `--execution-environment` as a plain string (resource name) and store it directly in the project context policy - [ ] Tests (Behave): Add/update BDD scenario for `agents project context set --execution-environment <resource-name>` accepting a resource name - [ ] Tests (Behave): Add scenario reproducing the bug (TDD issue-capture: `@tdd_expected_fail` until fix is in) - [ ] Tests (Robot): Add/update integration test verifying end-to-end resource name acceptance - [ ] 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. - The `ExecutionEnvironment` enum validation is removed from the project-level `context_set` handler; `--execution-environment` accepts any resource name string. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`fix(project): accept resource name in --execution-environment for project context set`), followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch `fix/project-context-exec-env-resource-name`. - 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.6.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
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
#398 Epic: Post-MVP Resources
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3871
No description provided.