Repository navigation
agentHost: give the Copilot runtime the real path of a symlinked folder - #349333
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Linked-workspace URI remapping can incorrectly rewrite hook and MCP definition URIs outside the resolved root, breaking navigation in Chat Customizations.
1 open issue
What changed in this PR
This PR addresses skipped repository hooks when a workspace is opened through a symbolic link. It gives the Copilot runtime the resolved working directory while preserving the opened path in Chat Customizations.
Changes:
- Resolve local working directories before creating or resuming sessions, falling back to the opened path on failure.
- Map runtime-reported hook and MCP definition paths back to the opened workspace path.
- Add symlink regression tests and update working-directory expectations.
| File | Description |
|---|---|
src/vs/platform/agentHost/test/node/sessionCustomizationDiscovery.test.ts |
Tests hook paths under a linked workspace. |
src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts |
Tests working-directory resolution and fallback behavior. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Updates expectations to use resolved working directories. |
src/vs/platform/agentHost/node/copilot/sessionCustomizationDiscovery.ts |
Maps definition paths back to opened workspace paths. |
src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts |
Supplies resolved working directories when creating and resuming sessions. |
Review effort: Balanced
Vritant Bhardwaj (vritant24)
marked this pull request as ready for review
November 19, 2026 22:33
Vritant Bhardwaj (vritant24)
enabled auto-merge
November 19, 2026 22:33
Vijay Upadya (vijayupadya)
previously approved these changes
Nov 19, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 19, 2026
Vritant Bhardwaj (vritant24)
force-pushed
the
dev/vritant24/hooks-symlink
branch
from
November 20, 2026 03:48
d670f1d to
4b8dc8e
Compare
Dmitriy Vasyura (dmitrivMS)
previously approved these changes
Nov 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
Vritant Bhardwaj (vritant24)
force-pushed
the
dev/vritant24/hooks-symlink
branch
from
November 20, 2026 17:21
4b8dc8e to
1a55c9e
Compare
Vritant Bhardwaj (vritant24)
enabled auto-merge
November 20, 2026 17:32
Federico Brancasi (federicobrancasi)
previously approved these changes
Nov 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
Vritant Bhardwaj (vritant24)
force-pushed
the
dev/vritant24/hooks-symlink
branch
from
November 20, 2026 21:22
1a55c9e to
8457936
Compare
Vritant Bhardwaj (vritant24)
enabled auto-merge
November 20, 2026 21:27
Federico Brancasi (federicobrancasi)
previously approved these changes
Nov 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 20, 2026
Vritant Bhardwaj (vritant24)
removed this pull request from the merge queue due to a manual request
Nov 20, 2026
Vritant Bhardwaj (vritant24)
enabled auto-merge
November 20, 2026 23:19
The Copilot runtime does not run a folder's repository hooks when the session was trusted through a symlinked path, so hooks never ran when VS Code opened a folder through a symlink. VS Code now passes the folder's real path as the session's working directory, and maps hook files the runtime reports under the real path back to the path the user opened. Fixes #347733 Co-authored-by: Copilot <[email protected]>
Definition files outside the folder's real path, such as user hooks, were rewritten relative to the opened path, which pointed Chat Customizations at the wrong files when the link and its target are at different depths. Co-authored-by: Copilot <[email protected]>
…opilot agent tests fs.promises.realpath uses the native implementation, which on Windows expands short path names and changes the drive letter case, so it did not match the working directory the launcher computes with Promises.realpath. Co-authored-by: Copilot <[email protected]>
Vritant Bhardwaj (vritant24)
force-pushed
the
dev/vritant24/hooks-symlink
branch
from
November 20, 2026 23:38
f84353e to
5f21ca3
Compare
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 20, 2026
This was referenced Nov 23, 2026
Closed
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.

Fixes #347733
What this changes
When a folder is opened through a symbolic link, VS Code gave the Copilot runtime the linked path. The runtime does not run a folder's repository hooks when the session was trusted through a linked path, so these hooks never ran.
This is independent of the other hook PRs and is based on
main.How to test
.github/hooks/log.jsonsessionStarthook that appends a line to a file, and a symbolic link to it (ln -s repo link).linkin VS Code.linkpath. Start a Copilot session: the hook runs.Validation
./scripts/test.sh --reporter dot --run src/vs/platform/agentHost/test/node/copilotSessionLauncher.test.ts --run src/vs/platform/agentHost/test/node/sessionCustomizationDiscovery.test.ts --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentCustomizationItemProvider.test.ts --run src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationMigration.test.ts --run src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationMigrationServiceImpl.test.ts: passed (1,543 passing, 1 pending)pnpm run typecheck-client: passed