Skip to content

Conversation

@anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Nov 17, 2025

Resolves: #148572
This would allow default shell to launch on non-wsl remote/local scenario as well.

@anthonykim1 anthonykim1 added this to the November 2025 milestone Nov 17, 2025
@anthonykim1 anthonykim1 self-assigned this Nov 17, 2025
Copilot AI review requested due to automatic review settings November 17, 2025 18:32
Copilot finished reviewing on behalf of anthonykim1 November 17, 2025 18:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where local terminals failed to open in remote workspace scenarios. The fix explicitly retrieves the local default profile before creating a terminal to ensure the correct local shell is used instead of accidentally using remote shell profiles.

Key Changes:

  • Added ITerminalProfileResolverService and OS imports to resolve local terminal profiles
  • Modified terminal creation to explicitly fetch and apply the local default profile configuration
  • Added explanatory comments describing the fix

@anthonykim1 anthonykim1 changed the title Fix issue where local terminal failed to open in remote scenarios Fix issue where local terminal failed to open in remote scenarios wsl Nov 18, 2025
@anthonykim1
Copy link
Contributor Author

anthonykim1 commented Nov 18, 2025

This would prevent the aggressive error message and also prevent immediate close of local terminal, but it won't respect local terminal profile setting. It would just open powershell for windows, regardless of if I had "terminal.integrated.defaultProfile.windows": "Git bash", for local windows settings in wsl scenario.

I think we need some way to ensure when terminal is opened, it respects corresponding profile (either remote or local) such as like in #277968 WIP

@anthonykim1 anthonykim1 requested a review from Tyriar November 18, 2025 08:05
@anthonykim1 anthonykim1 marked this pull request as ready for review November 18, 2025 08:05
@anthonykim1 anthonykim1 marked this pull request as draft November 18, 2025 23:02
Tyriar
Tyriar previously approved these changes Nov 18, 2025
@anthonykim1
Copy link
Contributor Author

anthonykim1 commented Nov 19, 2025

Some logs:

2025-11-19 08:46:58.691 [debug] #terminalService#createTerminal: Value of isLocalInRemoteTerminal is: false []
2025-11-19 08:46:58.692 [debug] $terminalService#createTerminal: options are: {"cwd":{"$mid":1,"fsPath":"c:\\Users\\antho","_sep":1,"external":"file:///c%3A/Users/antho","path":"/c:/Users/antho","scheme":"file"}} []
2025-11-19 08:46:58.692 [debug] #terminalService#createTerminal: available profile length is: 8 []
2025-11-19 08:46:58.692 [debug] #terminalService#createTerminal: config undefined []
2025-11-19 08:46:58.692 [debug] #terminalService#createTerminal: !config, so set it to new value: {"profileName":"bash","path":"/usr/bin/bash","isDefault":true,"isUnsafePath":false,"isFromPath":true,"icon":{"id":"terminal-bash"}} []
2025-11-19 08:46:58.693 [debug] #terminalService#createTerminal: shellLaunchConfig is {"executable":"/usr/bin/bash","icon":{"id":"terminal-bash"}} []

@Tyriar Is options?.cwd.scheme === Schemas.vscodeFileResource; supposed to be options?.cwd.scheme === Schemas.file instead in const isLocalInRemoteTerminal = this._remoteAgentService.getConnection() && URI.isUri(options?.cwd) && options?.cwd.scheme === Schemas.vscodeFileResource;

Update: changing to Schemas.file makes it work

@anthonykim1 anthonykim1 marked this pull request as ready for review November 19, 2025 18:38
@anthonykim1 anthonykim1 requested a review from Tyriar November 19, 2025 18:38
@anthonykim1 anthonykim1 enabled auto-merge (squash) November 20, 2025 18:54
@anthonykim1 anthonykim1 merged commit a745d81 into main Nov 20, 2025
28 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/tryRemoteLocal2 branch November 20, 2025 18:55
@anthonykim1 anthonykim1 changed the title Fix issue where local terminal failed to open in remote scenarios wsl Fix issue where local terminal failed to open in remote scenarios Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local terminal can't be opened: \bin\bash not found (though VS Code running on Windows)

3 participants