Repository navigation
Description
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:
-
Filesystem Project discovery creates an entry with a nonempty
ConfigPath
and stores it without registering a configuration-change watch:
lines 541–565. -
When Docker container discovery finds that existing entry, it registers
a watch only ifdc.ConfigPath == "" && configFile != "". Because
filesystem discovery already populatedConfigPath, registration is
skipped. The subsequentcontinuebypasses the new-entry path:
lines 970–985. -
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
- In a Coder workspace with Docker and devcontainer support, place a Git
repository containing.devcontainer/devcontainer.jsonwhere Coder's
filesystem Project discovery can find it. - Create the container independently:
devcontainer up --workspace-folder <repository> - Start or restart the workspace's Coder agent with filesystem Project
discovery enabled. - Wait until Coder discovers the repository and reports its existing
devcontainer as running. - Edit
.devcontainer/devcontainer.json, for example by changing a value
incontainerEnv. - 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
linear-code commentedon Nov 11, 2026
ENG-3533