Skip to content

Conversation

@anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Nov 24, 2025

Resolves: #275011
TODO: Remove my logs

Long story short, after 975a1ef, we ensure capabilities registered before shell integration events fire.

SOMEHOW
ShellIntegrationAddon._updatecwd and onDidChangeCwd was getting called before createProcess in remote.
Whereas, in non-remote, create process happened first, then updateCwd happened.

Edit: Maybe its more suspicious that activeWorkspaceUri is undefined.. for the wsl active workspace case:

2025-11-24 22:51:57.466 [debug] [9f844c9] MYLOG TerminalInstance#_createProcess: activeWorkspaceRootUri=undefined []
2025-11-24 22:51:57.466 [debug] [9f844c9] MYLOG TerminalInstance#_createProcess: Empty workspace cwd mismatch detected - cwd="\mnt\c\Users\antho\Desktop\All\vscode-copilot-chat", userHome="\home\anthonykim1", hasRemoteAuthority=true []

Regardless, we were going into

} else if (this._cwd && this._userHome && this._cwd !== this._userHome) {
// something strange is going on if cwd is not userHome in an empty workspace
this._onProcessExit({
message: nls.localize('workspaceNotTrustedCreateTerminalCwd', "Cannot launch a terminal process in an untrusted workspace with cwd {0} and userHome {1}", this._cwd, this._userHome)
});
which was what was causing the build tasks to fail.

@anthonykim1 anthonykim1 self-assigned this Nov 24, 2025
Copilot AI review requested due to automatic review settings November 24, 2025 23:17
Copilot finished reviewing on behalf of anthonykim1 November 24, 2025 23:19
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 adds temporary debug logging (prefixed with "MYLOG") to investigate a regression related to current working directory (cwd) behavior in WSL terminals. The logging traces cwd state changes through various lifecycle events in the terminal instance and shell integration addon.

Key Changes

  • Added debug logging to track cwd state changes during terminal lifecycle events
  • Instrumented shell integration capability addition, command restoration, and process creation
  • Logged remote authority and user home information to help diagnose WSL-specific issues

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Added 10 debug log statements tracking cwd changes, shell integration setup, and process creation in the terminal instance lifecycle
src/vs/platform/terminal/common/xterm/shellIntegrationAddon.ts Added 3 debug log statements tracking cwd updates and command deserialization in the shell integration addon

@anthonykim1 anthonykim1 added this to the November 2025 milestone Nov 25, 2025
@anthonykim1 anthonykim1 changed the title Debug wsl cwd regression 3 Resolve regression where build task did not start in wsl Nov 25, 2025
@anthonykim1
Copy link
Contributor Author

anthonykim1 commented Nov 26, 2025

VS Code Context Workspace State Terminal Type Expected Behavior Actual Behavior
Local Local Trusted ✅ Terminal opens ✅ Terminal opens
Local Untrusted Local ❌ Terminal blocked ❌ Terminal blocked
Local Empty Local ✅ Terminal opens ❌ Terminal blocked until I trust folder & continue in the modal dialog
Remote Trusted Remote ✅ Terminal opens ✅ Terminal opens
Remote Untrusted Remote ❌ Terminal blocked ❌ Terminal blocked for both remote&local terminal
Remote Empty Remote ✅ Terminal opens ✅ Terminal opens

(Unexpected Result):
case:
| Local | Empty | Local |
Expected: ✅ Terminal opens
Actual: ❌ Terminal blocked until I trust folder & continue in the modal dialog

Result seem same for both pre+post this PR though.

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.

Getting strange terminal message when opening VS Code in WSL on a trusted workspace

3 participants