Skip to content

Resolve regression where build task did not start in wsl#279249

Merged
anthonykim1 merged 14 commits intomainfrom
anthonykim1/wslCwdRegression3
Nov 27, 2025
Merged

Resolve regression where build task did not start in wsl#279249
anthonykim1 merged 14 commits intomainfrom
anthonykim1/wslCwdRegression3

Conversation

@anthonykim1
Copy link
Contributor

@anthonykim1 anthonykim1 commented Nov 24, 2025

Resolves: #275011

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
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

Testing result:

VS Code Context Workspace State Terminal Type Expected Behavior Actual Behavior (manual testing by Me)
Local Trusted Local ✅ 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 + local from remote ✅ Terminal opens ❌ Terminal blocked for both remote&local terminal. 355a637 and 2c40314 fixed it. Now ✅ Terminal opens
Remote Empty Remote ✅ Terminal opens ✅ Terminal opens

(Unexpected Results, at least to my understanding):

Case 1)
| Local | Empty | Local |
Expected: ✅ Terminal opens
Actual: ❌ Terminal blocked until I trust folder & continue in the modal dialog

However, case 1 is the same for pre+post PR. Maybe I should handle this case 1 in separate PR since it will be new behavior

Update: Resolved Case 2!
Case 2)
| Remote | Untrusted | Remote + local terminal from remote |
(might be wrong) Expected: ✅ Terminal opens for both remote & local
Actual: ❌ Terminal blocked for both remote&local terminal

Case 2 not same for pre-post PR, I probably broke something for case 2.
--> 355a637 will probably be enough to solve

--> Remote terminal works, but local in remote in untrusted still not working.

---> Got it working with: 2c40314 :)

@anthonykim1 anthonykim1 marked this pull request as ready for review November 26, 2025 03:28
@anthonykim1 anthonykim1 requested a review from Tyriar November 26, 2025 03:28
@anthonykim1 anthonykim1 marked this pull request as draft November 26, 2025 05:31
@anthonykim1 anthonykim1 marked this pull request as ready for review November 26, 2025 06:29
@anthonykim1 anthonykim1 enabled auto-merge (squash) November 26, 2025 21:52
@anthonykim1 anthonykim1 merged commit cc49204 into main Nov 27, 2025
49 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/wslCwdRegression3 branch November 27, 2025 00:13
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jan 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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

4 participants