Skip to content

bug: Discovered devcontainers are not marked outdated after configuration changes #32066

Description

@jnehlmeier

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I am working on a prototype which uses Coder internally and AI discovered that Coder does not detect changes to devcontainer.json in all cases. The following bug report has been generated via AI based on the findings it had in its context.


Summary

When Coder discovers a Project on disk and adopts its existing devcontainer,
editing .devcontainer/devcontainer.json does not mark the container outdated.

The same configuration edits are detected when filesystem Project discovery
is disabled and Coder discovers the container through Docker instead.

Related feature request: #16424

Actual behavior

The devcontainer remains marked current. Its dirty field in
GET /api/v2/workspaceagents/<agent-id>/containers remains false.

The initial observation waited 180 seconds without detecting the change.
Shorter, focused probes reproduced the failure repeatedly.

Explicitly rebuilding the devcontainer works and applies the changed
configuration.

Suspected cause

In agent/agentcontainers/api.go:

  1. Filesystem Project discovery creates an entry with a nonempty ConfigPath
    and stores it without registering a configuration-change watch:
    lines 541–565.

  2. When Docker container discovery finds that existing entry, it registers
    a watch only if dc.ConfigPath == "" && configFile != "". Because
    filesystem discovery already populated ConfigPath, registration is
    skipped. The subsequent continue bypasses the new-entry path:
    lines 970–985.

  3. By comparison, the new-entry path registers the configuration-change
    watch when a config path is available:
    lines 987–1003.

Registering the config watch when filesystem discovery adds the entry
may resolve this. No patch has been tested.

A regression test could force filesystem discovery to complete before
Docker container adoption, then edit the configuration and verify that
the devcontainer becomes outdated.

Relevant Log Output

Expected Behavior

Coder detects the configuration change and marks the devcontainer outdated.

Steps to Reproduce

  1. In a Coder workspace with Docker and devcontainer support, place a Git
    repository containing .devcontainer/devcontainer.json where Coder's
    filesystem Project discovery can find it.
  2. Create the container independently:
    devcontainer up --workspace-folder <repository>
  3. Start or restart the workspace's Coder agent with filesystem Project
    discovery enabled.
  4. Wait until Coder discovers the repository and reports its existing
    devcontainer as running.
  5. Edit .devcontainer/devcontainer.json, for example by changing a value
    in containerEnv.
  6. Check whether Coder marks the devcontainer outdated.

The failure appears dependent on discovery order: filesystem discovery must
record the repository before Coder processes its Docker container.

Environment

  • Coder 2.38.7, released binary
  • Coder agent running on Linux ARM64
  • Rootless Docker
  • devcontainer CLI 0.80.2
  • Filesystem Project discovery enabled:
    CODER_AGENT_DEVCONTAINERS_PROJECT_DISCOVERY_ENABLE=true

The affected source file, agent/agentcontainers/api.go, is identical in
2.38.7, 2.39.0 and 2.39.1. Only 2.38.7 was tested at runtime.

Additional Context

No response

Activity

  1. added theissue type on Nov 11, 2026
  2. linear-code commented on Nov 11, 2026

    @linear-code
  3. added
    good first issueEasily solved issues suitable for starters and community contributors
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issueEasily solved issues suitable for starters and community contributors

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions