UAT: Devcontainer auto-discovery not wired into production code path — discover_devcontainers() is never called during resource linking #2122

Open
opened 2026-04-03 04:15:52 +00:00 by freemo · 1 comment
Owner

Metadata

  • Branch: fix/wire-devcontainer-auto-discovery
  • Commit Message: fix(resource): wire devcontainer auto-discovery into project link-resource
  • Milestone: v3.7.0
  • Parent Epic: #397

Bug Report

What Was Tested

The devcontainer auto-discovery behavior when linking a git-checkout or fs-directory resource to a project.

Expected Behavior (from spec)

Per docs/specification.md lines 24834 and 24851, and ADR-043 §Auto-Discovery:

When git-checkout or fs-directory auto-discovery scans the filesystem tree, if a .devcontainer/devcontainer.json file is found, a devcontainer-instance child resource is created with provisioning_state: discovered.

Per ADR-043:

During filesystem scanning, if a .devcontainer/ directory is found: a. Look for devcontainer.json inside it (required). b. If found, create a devcontainer-instance child resource.

The spec requires that linking a git-checkout or fs-directory resource to a project automatically triggers devcontainer discovery and creates devcontainer-instance child resources.

Actual Behavior (from code)

The discover_devcontainers() function exists in src/cleveragents/resource/handlers/discovery.py and is fully implemented and tested in isolation. However, it is never called from any production code path.

Evidence from docs/reference/devcontainer_resources.md lines 62–66:

> **Not yet wired (F31/F23):** The discovery module
> (`discover_devcontainers()`) exists and is tested in isolation, but
> is **not** invoked during `project link-resource` or any other
> production code path. Auto-discovery will be wired in a follow-up PR.
> For now, devcontainer-instance resources must be added manually via
> `agents resource add`.

Searching the codebase confirms discover_devcontainers is only imported in test files, never in production service or CLI code.

Root Cause

The auto-discovery hook was not wired into the agents project link-resource command or the resource registration flow. The discovery module was implemented and tested in isolation but the integration step was deferred.

Code Location

  • src/cleveragents/resource/handlers/discovery.py: discover_devcontainers() function (implemented but not called)
  • src/cleveragents/cli/commands/project.py: link_resource() command (missing discovery hook)
  • src/cleveragents/application/services/: Resource registry service (missing discovery invocation)

Steps to Reproduce

  1. Create a directory with .devcontainer/devcontainer.json
  2. Register it as a git-checkout: agents resource add git-checkout local/my-repo --path /path/to/dir
  3. Create a project and link the resource: agents project link-resource local/my-project local/my-repo
  4. List resources: agents resource list
  5. Observe: No devcontainer-instance child resource is created automatically

Severity

High — This is a core feature of the devcontainer integration (ADR-043). Without auto-discovery, users must manually register devcontainer resources, defeating the purpose of the integration. The spec's execution environment routing (Level 3: nearest-ancestor devcontainer) cannot function without auto-discovery.

Subtasks

  • Wire discover_devcontainers() into the agents project link-resource command
  • Wire discover_devcontainers() into the resource registration flow for git-checkout and fs-directory types
  • Create devcontainer-instance child resources in the registry when discovery finds configs
  • Add integration test for auto-discovery via agents project link-resource
  • Update docs/reference/devcontainer_resources.md to remove the "Not yet wired" notice

Definition of Done

  • Linking a git-checkout resource containing .devcontainer/devcontainer.json automatically creates a devcontainer-instance child resource
  • The child resource is in detected state (lazy activation)
  • Auto-discovery works for both .devcontainer/devcontainer.json and root .devcontainer.json
  • Integration tests pass
  • All nox stages pass
  • Coverage >= 97%
  • The associated PR is merged

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/wire-devcontainer-auto-discovery` - **Commit Message**: `fix(resource): wire devcontainer auto-discovery into project link-resource` - **Milestone**: v3.7.0 - **Parent Epic**: #397 ## Bug Report ### What Was Tested The devcontainer auto-discovery behavior when linking a `git-checkout` or `fs-directory` resource to a project. ### Expected Behavior (from spec) Per `docs/specification.md` lines 24834 and 24851, and ADR-043 §Auto-Discovery: > When `git-checkout` or `fs-directory` auto-discovery scans the filesystem tree, if a `.devcontainer/devcontainer.json` file is found, a `devcontainer-instance` child resource is created with `provisioning_state: discovered`. Per ADR-043: > During filesystem scanning, if a `.devcontainer/` directory is found: a. Look for `devcontainer.json` inside it (required). b. If found, create a `devcontainer-instance` child resource. The spec requires that linking a `git-checkout` or `fs-directory` resource to a project automatically triggers devcontainer discovery and creates `devcontainer-instance` child resources. ### Actual Behavior (from code) The `discover_devcontainers()` function exists in `src/cleveragents/resource/handlers/discovery.py` and is fully implemented and tested in isolation. However, it is **never called** from any production code path. Evidence from `docs/reference/devcontainer_resources.md` lines 62–66: ``` > **Not yet wired (F31/F23):** The discovery module > (`discover_devcontainers()`) exists and is tested in isolation, but > is **not** invoked during `project link-resource` or any other > production code path. Auto-discovery will be wired in a follow-up PR. > For now, devcontainer-instance resources must be added manually via > `agents resource add`. ``` Searching the codebase confirms `discover_devcontainers` is only imported in test files, never in production service or CLI code. ### Root Cause The auto-discovery hook was not wired into the `agents project link-resource` command or the resource registration flow. The discovery module was implemented and tested in isolation but the integration step was deferred. ### Code Location - `src/cleveragents/resource/handlers/discovery.py`: `discover_devcontainers()` function (implemented but not called) - `src/cleveragents/cli/commands/project.py`: `link_resource()` command (missing discovery hook) - `src/cleveragents/application/services/`: Resource registry service (missing discovery invocation) ### Steps to Reproduce 1. Create a directory with `.devcontainer/devcontainer.json` 2. Register it as a git-checkout: `agents resource add git-checkout local/my-repo --path /path/to/dir` 3. Create a project and link the resource: `agents project link-resource local/my-project local/my-repo` 4. List resources: `agents resource list` 5. Observe: No `devcontainer-instance` child resource is created automatically ### Severity **High** — This is a core feature of the devcontainer integration (ADR-043). Without auto-discovery, users must manually register devcontainer resources, defeating the purpose of the integration. The spec's execution environment routing (Level 3: nearest-ancestor devcontainer) cannot function without auto-discovery. ## Subtasks - [ ] Wire `discover_devcontainers()` into the `agents project link-resource` command - [ ] Wire `discover_devcontainers()` into the resource registration flow for `git-checkout` and `fs-directory` types - [ ] Create `devcontainer-instance` child resources in the registry when discovery finds configs - [ ] Add integration test for auto-discovery via `agents project link-resource` - [ ] Update `docs/reference/devcontainer_resources.md` to remove the "Not yet wired" notice ## Definition of Done - [ ] Linking a `git-checkout` resource containing `.devcontainer/devcontainer.json` automatically creates a `devcontainer-instance` child resource - [ ] The child resource is in `detected` state (lazy activation) - [ ] Auto-discovery works for both `.devcontainer/devcontainer.json` and root `.devcontainer.json` - [ ] Integration tests pass - [ ] All nox stages pass - [ ] Coverage >= 97% - [ ] The associated PR is merged --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
freemo added this to the v3.7.0 milestone 2026-04-03 04:15:59 +00:00
freemo self-assigned this 2026-04-03 16:58:04 +00:00
Author
Owner

MoSCoW classification: Should Have

Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible.


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

MoSCoW classification: **Should Have** Rationale: This issue addresses a spec requirement or important quality improvement. It should be included in the milestone if possible. --- **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.

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