feat(devcontainer): wire devcontainer auto-detection and execution environment routing #1208

Open
opened 2026-03-30 10:11:10 +00:00 by hurui200320 · 0 comments
Member

Metadata

  • Commit Message: feat(devcontainer): wire devcontainer auto-detection and execution environment routing
  • Branch: feature/devcontainer-e2e-wiring

Background

Individual devcontainer components were built in M6/M7 (#511 resource type, #512 execution environment routing, #514 lifecycle management, #515 container tool execution, #827 content operations), but they were never connected to the production CLI and lifecycle code paths.

The WF16 E2E test (robot/e2e/wf16_devcontainer.robot, #762) exercises the full devcontainer-driven development workflow per Specification Example 16 and correctly identifies four missing behaviors (AC-3 through AC-6). These failures are not test bugs — they reflect genuine integration gaps where existing components are not wired together.

Current Behavior

  1. agents resource add git-checkout does not call discover_devcontainers() — even when the repository contains .devcontainer/devcontainer.json, no devcontainer-instance child resource is created and no "detected (not built)" output is emitted.
  2. ExecutionEnvironmentResolver resolves execution environments via tool→plan→project→default(HOST) priority chain, but does not implement the specification's Level 3 "nearest-ancestor devcontainer" resolution. No code searches the resource DAG for devcontainer-instance children.
  3. During plan execute, no lazy container build is triggered because there is no devcontainer resolution step that would discover and activate the container.
  4. During plan apply, no "bind mount" mechanism signal is emitted — the apply output does not mention the sync path from container workspace to host filesystem.

Expected Behavior

Per Specification Example 16:

  1. resource add auto-discovers .devcontainer/devcontainer.json and registers a devcontainer-instance child in detected (not built) state with a CLI warning.
  2. plan execute resolves the nearest-ancestor devcontainer as the execution environment (Level 3 of 6), lazily builds the container on first access, and routes tool invocations to the container workspace (/workspaces/<project>).
  3. plan apply announces bind mount synchronization from container workspace back to host.

Acceptance Criteria

  • resource add git-checkout calls discover_devcontainers() and creates a devcontainer-instance child resource in detected (not built) state when .devcontainer/devcontainer.json is present
  • CLI output for resource add includes devcontainer detection warning matching spec Example 16 Step 1
  • ExecutionEnvironmentResolver implements nearest-ancestor devcontainer resolution (Level 3) per specification priority chain
  • plan execute triggers lazy container build when the resolved environment is a devcontainer and emits build progress output
  • plan execute output includes execution environment routing indicators (resource identity, resolved-via, workspace ath) matching spec Example 16 Step 4
  • plan apply output includes bind mount mechanism signal matching spec Example 16 Step 5
  • WF16 E2E test (robot/e2e/wf16_devcontainer.robot) passes all AC checks (AC-3 through AC-6) without tdd_expected_fail inversion
  • tdd_expected_fail tag removed from WF16 test; tdd_issue and tdd_issue_<N> tags remain as permanent regression markers referencing this ticket
  • All existing tests continue to pass
  • Coverage >= 97%

Subtasks

  • Wire discover_devcontainers() into resource add / register_resource() pipeline
  • Add devcontainer detection output to resource add CLI response
  • Add nearest-ancestor devcontainer resolution (Level 3) to ExecutionEnvironmentResolver
  • Wire lazy container build trigger into plan execution when the devcontainer environment is resolved
  • Add execution environment routing output to plan execute CLI output
  • Add bind mount mechanism output to plan apply CLI output
  • Update WF16 E2E test: remove tdd_expected_fail tag, update tdd_issue_<N> to reference this ticket
  • Tests (Behave): Add scenarios for devcontainer auto-detection during resource registration
  • Tests (Robot): Add integration tests for execution environment resolver with devcontainer Level 3
  • 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.

Supporting Information

  • Specification: Example 16 (line 42321+) — Devcontainer-Driven Development
  • WF16 E2E test: robot/e2e/wf16_devcontainer.robot (#762)
  • Discovery function: src/cleveragents/resource/handlers/discovery.pydiscover_devcontainers()
  • Execution resolver: src/cleveragents/application/services/execution_environment_resolver.py
  • Devcontainer handler: src/cleveragents/resource/handlers/devcontainer.py
  • Container executor: src/cleveragents/tool/container_executor.py
  • Resource CLI: src/cleveragents/cli/commands/resource.pyresource_add()
  • Related closed tickets: #511 (resource type), #512 (env routing), #514 (lifecycle), #515 (container tool exec), #827 (content ops)
  • Parent epic: #397 (Epic: Server & Autonomy Infrastructure)
## Metadata - **Commit Message**: `feat(devcontainer): wire devcontainer auto-detection and execution environment routing` - **Branch**: `feature/devcontainer-e2e-wiring` ## Background Individual devcontainer components were built in M6/M7 (#511 resource type, #512 execution environment routing, #514 lifecycle management, #515 container tool execution, #827 content operations), but they were never connected to the production CLI and lifecycle code paths. The WF16 E2E test (`robot/e2e/wf16_devcontainer.robot`, #762) exercises the full devcontainer-driven development workflow per Specification Example 16 and correctly identifies four missing behaviors (AC-3 through AC-6). These failures are not test bugs — they reflect genuine integration gaps where existing components are not wired together. ## Current Behavior 1. `agents resource add git-checkout` does not call `discover_devcontainers()` — even when the repository contains `.devcontainer/devcontainer.json`, no `devcontainer-instance` child resource is created and no "detected (not built)" output is emitted. 2. `ExecutionEnvironmentResolver` resolves execution environments via tool→plan→project→default(HOST) priority chain, but does not implement the specification's Level 3 "nearest-ancestor devcontainer" resolution. No code searches the resource DAG for `devcontainer-instance` children. 3. During `plan execute`, no lazy container build is triggered because there is no devcontainer resolution step that would discover and activate the container. 4. During `plan apply`, no "bind mount" mechanism signal is emitted — the apply output does not mention the sync path from container workspace to host filesystem. ## Expected Behavior Per Specification Example 16: 1. `resource add` auto-discovers `.devcontainer/devcontainer.json` and registers a `devcontainer-instance` child in `detected (not built)` state with a CLI warning. 2. `plan execute` resolves the nearest-ancestor devcontainer as the execution environment (Level 3 of 6), lazily builds the container on first access, and routes tool invocations to the container workspace (`/workspaces/<project>`). 3. `plan apply` announces bind mount synchronization from container workspace back to host. ## Acceptance Criteria - [ ] `resource add git-checkout` calls `discover_devcontainers()` and creates a `devcontainer-instance` child resource in `detected (not built)` state when `.devcontainer/devcontainer.json` is present - [ ] CLI output for `resource add` includes devcontainer detection warning matching spec Example 16 Step 1 - [ ] `ExecutionEnvironmentResolver` implements nearest-ancestor devcontainer resolution (Level 3) per specification priority chain - [ ] `plan execute` triggers lazy container build when the resolved environment is a devcontainer and emits build progress output - [ ] `plan execute` output includes execution environment routing indicators (resource identity, resolved-via, workspace ath) matching spec Example 16 Step 4 - [ ] `plan apply` output includes bind mount mechanism signal matching spec Example 16 Step 5 - [ ] WF16 E2E test (`robot/e2e/wf16_devcontainer.robot`) passes all AC checks (AC-3 through AC-6) without `tdd_expected_fail` inversion - [ ] `tdd_expected_fail` tag removed from WF16 test; `tdd_issue` and `tdd_issue_<N>` tags remain as permanent regression markers referencing this ticket - [ ] All existing tests continue to pass - [ ] Coverage >= 97% ## Subtasks - [ ] Wire `discover_devcontainers()` into `resource add` / `register_resource()` pipeline - [ ] Add devcontainer detection output to `resource add` CLI response - [ ] Add nearest-ancestor devcontainer resolution (Level 3) to `ExecutionEnvironmentResolver` - [ ] Wire lazy container build trigger into plan execution when the devcontainer environment is resolved - [ ] Add execution environment routing output to plan execute CLI output - [ ] Add bind mount mechanism output to plan apply CLI output - [ ] Update WF16 E2E test: remove `tdd_expected_fail` tag, update `tdd_issue_<N>` to reference this ticket - [ ] Tests (Behave): Add scenarios for devcontainer auto-detection during resource registration - [ ] Tests (Robot): Add integration tests for execution environment resolver with devcontainer Level 3 - [ ] 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. ## Supporting Information - **Specification**: Example 16 (line 42321+) — Devcontainer-Driven Development - **WF16 E2E test**: `robot/e2e/wf16_devcontainer.robot` (#762) - **Discovery function**: `src/cleveragents/resource/handlers/discovery.py` →`discover_devcontainers()` - **Execution resolver**: `src/cleveragents/application/services/execution_environment_resolver.py` - **Devcontainer handler**: `src/cleveragents/resource/handlers/devcontainer.py` - **Container executor**: `src/cleveragents/tool/container_executor.py` - **Resource CLI**: `src/cleveragents/cli/commands/resource.py` → `resource_add()` - **Related closed tickets**: #511 (resource type), #512 (env routing), #514 (lifecycle), #515 (container tool exec), #827 (content ops) - **Parent epic**: #397 (Epic: Server & Autonomy Infrastructure)
hurui200320 added this to the v3.5.0 milestone 2026-03-30 10:11:17 +00:00
freemo self-assigned this 2026-04-02 06:13:54 +00:00
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.

Reference
cleveragents/cleveragents-core#1208
No description provided.