agentHost: Share Dev Container CLI and server caches - #336914
Draft
Christof Marti (chrmarti) wants to merge 2 commits into
Draft
Christof Marti (chrmarti) wants to merge 2 commits into
Christof Marti (chrmarti) wants to merge 2 commits into
Conversation
Link only the CLI servers directory to a platform-partitioned cache in the vscode volume. Keep credentials and runtime state private, preserve existing caches and mount configuration, and report optional-cache fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Christof Marti (chrmarti)
September 20, 2026 12:12
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
An unwritable existing shared-cache symlink prevents the promised private-cache fallback, and creation behavior lacks direct shell coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds shared VS Code Server caching for Dev Containers through the vscode Docker volume.
Changes:
- Adds cache mount detection, creation, partitioning, and symlink setup.
- Integrates graceful fallback into Dev Container startup.
- Adds tests and documents the storage contract.
| File | Description |
|---|---|
REMOTE_AGENT_HOST_SESSIONS_PROVIDER.md |
Documents shared-cache behavior. |
devContainerServerCache.test.ts |
Tests cache paths, mounts, and symlinks. |
devContainerAgentHostService.test.ts |
Tests service integration and fallback. |
devContainerServerCache.ts |
Implements cache helpers and shell commands. |
devContainerAgentHostService.ts |
Integrates cache setup into container startup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+82
to
+84
| 'test -d "$cache_dir" && test -w "$cache_dir" || { echo "Shared server cache is not writable" >&2; exit 1; }', | ||
| 'for entry in "$cache_dir/lru.json" "$cache_dir/.locks"; do', | ||
| ' if [ -L "$entry" ] || { [ -e "$entry" ] && [ ! -w "$entry" ]; }; then echo "Shared server cache metadata is not writable" >&2; exit 1; fi', |
| } | ||
|
|
||
| /** Creates only missing cache directories, without changing ownership of an existing shared cache. */ | ||
| export function buildCreateDevContainerServerCacheCommand(cachePath: string, uid: string, gid: string): string { |
Cache commit-pinned CLI executables in the shared vscode volume with per-entry file locks and atomic publication. Install private copies so self-update and cache eviction cannot affect other containers. Keep ordinary SSH and Dev Tunnel host installation unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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
Avoid repeated CLI and VS Code Server downloads for fresh Dev Containers by sharing caches through the Docker
vscodevolume.serversdirectory to/vscode/<server-data-folder>/cli/servers/<linux|alpine>-<arch>before starting the CLI. Credentials, endpoint registration, logs, and other runtime state remain private to each container./vscode/<server-data-folder>/cli/bin/<linux|alpine>-<arch>/<quality>-<commit>. The installer uses per-entry file locks and atomic publication, then installs an independent private copy. No pre-existing CLI is required to bootstrap the cache.flockis unavailable.Scope: Dev Containers only, whether launched locally or through SSH, Dev Tunnels, or WSL. Ordinary SSH and Dev Tunnel host CLI installations are unchanged.
Reviewer notes
No Rust CLI changes or migration of the Dev Containers extension's older server-cache layout. Server-cache locking, LRU, and eviction remain CLI-owned and unchanged; this does not introduce cross-container server in-use leases. The bootstrap CLI cache is separately installer-owned. Existing shared directories are not re-owned to force sharing across different UIDs.
Validation
npm run compile-clientpassed, plus 60 focused service/cache/protocol/connector tests.npm run typecheck-client, fresh transpilation, scoped hygiene, and commit hooks passed; 125 focused cache/installer/Dev Container/SSH regression tests passed on macOS (Linux shell tests skipped there).UI smoke validation remains blocked: the earlier local/SSH smoke run failed in setup before workbench startup, without reaching cache or container behavior. It is not counted as passing.