Skip to content

fix(devcontainer): exclude agent worktrees from the VS Code watcher - #6454

Merged
dan-petty merged 4 commits into
mainfrom
fix/6453-vscode-watcher-exclude
Nov 19, 2026
Merged

dan-petty merged 4 commits into
mainfrom
fix/6453-vscode-watcher-exclude

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The VS Code file watcher held 524137 of the 524288 inotify watches of the user, so other programs could not add a watch: aardvark-dns stopped and container names did not resolve. .vscode/settings.json now sets files.watcherExclude for .data/, repos/, .claude/worktrees/, .venv/ and the tool caches. These folders held about 520000 of the 528000 folders of the checkout. VS Code merges the setting with its default excludes, so the setting does not repeat them. One workspace setting covers VS Code and Antigravity and applies with no rebuild. docs/DEVCONTAINER_USAGE.md tells where the setting is and how to count the watches.

Closes #6453

Change: openspec/changes/archive/2026-11-19-6453-vscode-watcher-exclude/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/devcontainer The DevContainer, its image and its features labels Nov 19, 2026
@dan-petty

dan-petty commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner Author

Test record

Person step after the merge: update the main checkout that the VS Code window shows, then run the count below. VS Code starts its watcher again when files.watcherExclude changes. Developer: Reload Window also applies the setting. No rebuild is necessary.

Measurement before the change (2026-11-19, VS Code Insiders 1.148.0)

Process inotify watches Limit (/proc/sys/fs/inotify/max_user_watches)
--type=fileWatcher 524137 524288

Folders of the checkout (find <tree> -type d | wc -l). The parcel watcher adds one watch for each folder:

Tree Folders
.data/ 381348
.claude/worktrees/ 93127
repos/ 37797
.venv/ 8056
All other folders, with the default excludes of VS Code 8033

Expected count after the change: about 8000 watches, which is 1.5 percent of the limit.

Command for the count after the change

for pid in $(pgrep -u "$(id -u)" -f '[-]-type=fileWatcher'); do echo "$pid $(cat /proc/$pid/fdinfo/* 2>/dev/null | grep -c '^inotify')"; done

The issue also asks for this check: docker compose exec b ping -c1 a works in a rootless podman-in-podman container on debian:sid.

Local checks on the final head

  • uv run devops ci --check --only lint,format,docs,constructs,openspec,test-settings,test-tree,startup-imports,swallowed-failures: all rows pass.
  • uv run devops ci test tests/invariants/test_uv_malware_check.py (the test that reads docs/DEVCONTAINER_USAGE.md): 6 passed.
  • Fail-to-pass: not run. The change has no path under src/, and CONTRIBUTING.md gives no check to a fix that changes only config files and documents.
  • No test reads the new setting (owner rule: no test of a config value).

Decisions against the issue text

  • .claude/worktrees/** is also excluded. The worktrees of Claude Code held 93127 folders, 18 percent of the limit. The issue did not name them.
  • The setting does not repeat the default excludes. VS Code merges an object setting with its default (mergeContents in src/vs/platform/configuration/common/configurationModels.ts). The current defaults are .git/objects/**, .git/subtree-cache/**, .hg/store/** and the same three with */ before them. **/node_modules/*/** is no longer a default.
  • The patterns start at the workspace folder and not with **/. The VS Code source says that a ** pattern makes a slow regular expression in a large workspace. A census found .venv, .mypy_cache, .ruff_cache and .pytest_cache only at the root, outside the excluded trees.
  • files.exclude and search.exclude do not change the watcher: workspaceWatcher.ts reads only files.watcherExclude.

One settings file (head 512370f):

$ grep -rn files.watcherExclude .vscode .devcontainer
.vscode/settings.json:4:  "files.watcherExclude": {

@dan-petty
dan-petty force-pushed the fix/6453-vscode-watcher-exclude branch from 16eccf7 to 512370f Compare November 19, 2026 19:55
@dan-petty
dan-petty marked this pull request as ready for review November 19, 2026 20:02
@dan-petty
dan-petty merged commit 8952d83 into main Nov 19, 2026
24 checks passed
@dan-petty
dan-petty deleted the fix/6453-vscode-watcher-exclude branch November 19, 2026 20:23
dan-petty pushed a commit that referenced this pull request Nov 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.181.1](v0.181.0...v0.181.1)
(2026-11-19)


### Bug Fixes

* **devcontainer:** exclude agent worktrees from the VS Code watcher
([#6454](#6454))
([8952d83](8952d83))
* **telemetry:** drop the copied weaver version from the install hint
([#6462](#6462))
([e3ed7e7](e3ed7e7))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/devcontainer The DevContainer, its image and its features type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(devcontainer): stop VS Code from watching agent worktrees and clones

1 participant