fix(vscode): stop leaking PII in remotePlatform, cut remote memory/CPU overhead - #773
Merged
Conversation
…form extensions.autoUpdate was inverted against its own comment (APPLICATION scope, verified against microsoft/vscode's extensions.contribution.ts) -- this produced six concurrently-installed Claude Code extension versions on the remote. Extends files.watcherExclude/search.exclude to cover the ~11 GB ~/.vscode-server tree, the brew symlink farm and mise's toolchain store, caps tsserver memory, and narrows the git extension's background repository scanning -- all confirmed RESOURCE/WINDOW scope, so they load from this file (VS Code Remote reads User settings from the client for every scope except MACHINE/MACHINE_OVERRIDABLE). remote.SSH.remotePlatform previously hardcoded the deployment's real domain and username in plaintext. One of the two host-key entries doesn't parse under the Coder VS Code extension's current SSH authority format (coder/vscode-coder's src/util/authority.ts) and predates it, so it's dropped; the other is templated using the domain's existing bitwardenSecrets UUID (already used elsewhere in this repo) plus a new coderUsername prompt. Adds private_dot_local/bash/limits.bash to restore an unlimited soft RLIMIT_DATA in every interactive shell, for ppat/coder#859's watchdog, which stamps that limit on the VS Code server tree and relies on inheriting terminals restoring themselves. Roo Code stays in remote.SSH.defaultExtensions -- its removal is blocked on the Mac-side backup in #770. Ref: #772 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…args grep -rl | xargs (no -Z/-0) word-splits on spaces in paths. This repo's own private_Application Support tree has one, and the previous commit added the first *.tmpl file under it -- full-apply-test's "Fake out bitwardenSecrets calls" step failed immediately once that path was actually matched by --include='*.tmpl'. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reduces VS Code's remote memory footprint (Phase 2 of the plan behind
ppat/coder#859's watchdog) and stops two personal identifiers from being
committed in plaintext.
extensions.autoUpdatewas inverted against its own comment. Thecomment said "Prevent extensions from automatically updating" directly
above
"extensions.autoUpdate": true. This is what produced sixconcurrently-installed Claude Code extension versions on the remote.
Fixed to
"off"(the string value the currentextensions.autoUpdateschema expects — VS Code's own configuration-migration code maps a
legacy boolean
falseto"off"automatically, but setting the stringdirectly avoids depending on that migration, including the in-place
rewrite it would otherwise make to this chezmoi-managed file).
extensions.autoCheckUpdates: falseadded alongside it.files.watcherExclude/search.excludeextended to cover theremote home's ~11 GB
~/.vscode-servertree (previously watchingitself), the Homebrew symlink farm, and mise's per-version toolchain
store, plus
.terraform,.cache,.cargo,go/pkg,.claude,target,vendor,.venv.search.followSymlinks: falseadded sincethe brew/mise trees are themselves symlink farms.
typescript.tsserver.maxTsServerMemorycapped at 2048 MB andautomatic type acquisition disabled — tsserver was otherwise unbounded.
git.autoRepositoryDetection: "openEditors",git.repositoryScanMaxDepth: 1,git.autofetch: false. Note: the last two already match currentupstream VS Code defaults, so their practical effect depends on the
installed VS Code version — kept for explicitness/robustness rather
than because they're guaranteed to change behavior today.
remote.extensionKindadded forvscode-icons-team.vscode-iconsand
bierner.markdown-mermaid, pushing them to the local (UI) extensionhost instead of the remote.
PII fix:
remote.SSH.remotePlatformpreviously hardcoded the Coderdeployment's real domain and the operator's real username/workspace name
in plaintext, in this public repo. One of the two host-key entries does
not parse under the Coder VS Code extension's current SSH-authority
format (verified against
coder/vscode-coder'ssrc/util/authority.tson GitHub) and predates it — dropped rather than templated. The other is
templated: the domain now resolves through the same
bitwardenSecretsUUID this repo already uses for it elsewhere (
private_dot_env.secrets.tmpl,run_after_61_kubeconfig.sh.tmpl); the username/workspace segment is anew
coderUsernamevalue prompted once via.chezmoi.toml.tmpl, the samemechanism already used for
name/email/bwsAccessToken. Git historystill contains the old plaintext values — this fixes it going forward
only.
Added
private_dot_local/bash/limits.bash(auto-sourced by theexisting
dot_bashrcloop over~/.local/bash/): restores an unlimitedsoft
RLIMIT_DATAin every interactive shell. The memory watchdog(ppat/coder#859) stamps a soft
RLIMIT_DATAon the VS Code server processtree; terminals forked from
ptyHostinherit that limit, and thewatchdog leaves the hard limit at
unlimitedspecifically so a shell canrestore itself.
Roo Code is untouched in
remote.SSH.defaultExtensions— its removalis blocked on the Mac-side backup in #770, which hasn't
happened yet.
Scope verification (VS Code source, not assumption)
Checked against
microsoft/vscode's own configuration registrations(
extensions.contribution.ts,files.contribution.ts,search.contribution.ts,remote.contribution.ts) and thegit/typescript-language-featuresbundled extensions'package.json:extensions.autoUpdate,extensions.autoCheckUpdatesremote.extensionKind[MACHINE, MACHINE_OVERRIDABLE]files.watcherExclude,search.excludesearch.followSymlinks,typescript.tsserver.maxTsServerMemory,typescript.disableAutomaticTypeAcquisitiongit.autoRepositoryDetectiongit.autofetch,git.repositoryScanMaxDepthAll of the above land in the Mac user settings file
(
private_Library/private_Application Support/private_Code/User/settings.json.tmpl)for the same reason: in a Remote-SSH window, User settings come from the
client and apply to the remote window for every scope except
MACHINE/MACHINE_OVERRIDABLE. The remote Machine settings file(
private_dot_vscode-server/data/Machine/settings.json) is untouched —its existing entries (
mise.binPath,shellcheck.executablePath,git.defaultCloneDirectory) are genuinely machine-scoped.One incidental finding, not fixed here since it's outside this task's
scope: that Machine settings file also already contains
git.pruneOnFetch,which is RESOURCE-scoped, not
MACHINE/MACHINE_OVERRIDABLE— it'slikely already silently inert in that file today. Worth a follow-up.
What still needs the owner to confirm
This branch could not be applied on the current machine (
chezmoi apply/chezmoi updateare off-limits here — it's a shared liveworkspace) or on the Mac. Verification here was
chezmoi execute-templateagainst a scratch config seeded with fake values (mirroring exactly what
CI's
full-apply-test.yamldoes), plus reviewing the rendered JSON byhand.
chezmoi diffitself could not be exercised at all on thismachine — its local
bwsAccessTokenis already being rejected by theBitwarden Secrets Manager API for an unrelated, pre-existing reason.
After merging, every machine needs one
chezmoi initre-run (Macincluded) before its next
chezmoi apply/chezmoi update: the newcoderUsernameprompt is only asked bychezmoi init, and until it'sanswered once, this file fails to render with a hard template error
(
map has no entry for key "coderUsername"), which would otherwise abortthe whole apply.
promptStringOncemeans this is asked exactly once, sameas the existing
name/email/bwsAccessTokenprompts.Once applied, the owner should open Settings UI in a reconnected remote
window and confirm each new setting shows the right value and the right
provenance (User vs Remote) — that's the only real proof a setting isn't
silently inert, and it can't be checked from here.
Test plan
pre-commit run --all-filespassesshellcheck --rcfile .shellcheckrc private_dot_local/bash/limits.bashcleanchezmoi execute-templaterenders the changed template cleanly withCI's exact fake-value substitution (
fake-test-valueforbitwardenSecrets, fakecoderUsername)//comments andtrailing commas (same JSONC shape as the file already had)
chezmoi initonce per machine, thenchezmoi diff/applyafter reconnecting to the remote
normal work
Ref: #772