Skip to content

fix(agent/agentcontainers): watch config of discovered devcontainers - #32105

Open
stirby wants to merge 1 commit into
mainfrom
fix/issue-32066-devcontainer-config-watch
Open

stirby wants to merge 1 commit into
mainfrom
fix/issue-32066-devcontainer-config-watch

Conversation

@stirby

@stirby stirby commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Editing devcontainer.json didn't mark a devcontainer outdated when filesystem project discovery found the project before the Docker container was listed.

Project discovery stored the devcontainer with its ConfigPath set but never registered a file watch. When the container was later listed, container discovery only adds a watch for entries it creates or entries without a config path, so the config was never watched. Project discovery now registers the watch when it adds the devcontainer. The fsnotify watcher ignores repeated Add calls for the same file.

Fixes #32066

Implementation notes
  • New TestDevcontainerDiscovery/WatchConfigDiscoveredBeforeContainer: discover the project with no container, then add a matching container and refresh. The test asserts the watch is registered, sends a write event, and asserts the devcontainer is dirty. It fails on main (no watched path). Passes with -race -count=20.
  • Related gap left out of scope: devcontainers from the workspace manifest with an explicit ConfigPath hit the same ConfigPath == "" condition and may also be unwatched.
  • Checks run: go test -race ./agent/agentcontainers/..., go vet, golangci-lint (both configs).

Generated by Coder Agents on behalf of @stirby.

Project discovery added devcontainers with a config path but never
registered a file watch for that config. When the container was later
listed, container discovery only added a watch for entries it created or
entries without a config path, so the discovered config was never
watched and editing devcontainer.json did not mark the devcontainer
dirty.

Register the watch when project discovery adds the devcontainer. The
fsnotify watcher ignores repeated Add calls for the same file.

Fixes #32066
@stirby
stirby temporarily deployed to main November 12, 2026 17:51 — with GitHub Actions Inactive
@stirby
stirby temporarily deployed to main November 12, 2026 17:51 — with GitHub Actions Inactive
@stirby
stirby marked this pull request as ready for review November 13, 2026 19:28
@stirby
stirby temporarily deployed to main November 13, 2026 19:28 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
main — 7012f20d Deployed Nov 13, 2026 by stirby via cla #256942
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Discovered devcontainers are not marked outdated after configuration changes

1 participant