Repository navigation
Fix Copilot terminal profile resolution when shell doesn't exist - #321154
Merged
Merged
Conversation
When the resolved default shell (e.g. zsh) is not installed on the system, the Copilot terminal tool fails with 'Path to shell executable does not exist'. This adds a validation step in getCopilotProfile that checks whether the resolved shell binary exists on disk and falls back to /bin/bash or /bin/sh when it doesn't. Fixes #319302 Co-authored-by: Copilot <[email protected]>
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Copilot “Run in Terminal” tool’s robustness when resolving the terminal profile by validating that the resolved shell executable exists and falling back to a known POSIX shell when it doesn’t, avoiding failures like Path to shell executable "zsh" does not exist.
Changes:
- Add POSIX shell fallback candidates and validation for non-Windows shell executables.
- Introduce filesystem existence checks via
IFileService.existsand emit a warning when falling back.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.ts | Adds shell existence validation and POSIX fallback selection for Copilot’s terminal profile resolution. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 3
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Benjamin Christopher Simmonds (benibenj)
approved these changes
Jun 12, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
When the resolved default shell (e.g.
zsh) is not installed on the system, the Copilot terminal tool fails withPath to shell executable "zsh" does not exist. This causes all terminal commands to fail, including sandbox retries with network access.Root Cause
TerminalProfileService.getDefaultProfile(os)filters out auto-detected profiles (!e.isAutoDetected). On Linux, the user-configured default (e.g. "bash") is typically auto-detected, so the lookup returnsundefined. The fallback resolution can then pick up a shell that isn't actually installed (e.g. zsh from a stale profile list).Fix
Added a validation step in
getCopilotProfile()that checks whether the resolved shell binary exists on disk (viaIFileService.exists). When it doesn't, it falls back to the first available shell from[/bin/bash, /usr/bin/bash, /bin/sh].Only applies to non-Windows platforms since Windows shell paths are handled differently.
Fixes #319302