Skip to content

fix: Propagate forceShellIntegration to remote terminal server#300428

Open
renan-r-santos wants to merge 1 commit intomicrosoft:mainfrom
renan-r-santos:fix-python-debug-remote
Open

fix: Propagate forceShellIntegration to remote terminal server#300428
renan-r-santos wants to merge 1 commit intomicrosoft:mainfrom
renan-r-santos:fix-python-debug-remote

Conversation

@renan-r-santos
Copy link
Contributor

Fixes microsoft/vscode-python-environments#1337

Debug terminals are created with isFeatureTerminal: true and forceShellIntegration: true. The forceShellIntegration flag is needed because VS Code skips shell integration injection for feature terminals by default (see terminalEnvironment.ts).

The problem is that forceShellIntegration is not included in IShellLaunchConfigDto, which is the DTO used to serialize the shell launch config when sending it from the client to the remote server. So while isFeatureTerminal: true is correctly propagated, forceShellIntegration is silently dropped.

On the remote server, the shell integration injection check sees isFeatureTerminal: true and forceShellIntegration: undefined, and skips injection. Without shell integration, the Python activation hooks built into VS Code's shell integration scripts (e.g. the VSCODE_PYTHON_BASH_ACTIVATE eval in shellIntegration-bash.sh) never run. The .bashrc also doesn't have the activation code because the Python Environments extension skipped profile modification after detecting that shell integration was available.

Locally this works because the full IShellLaunchConfig (including forceShellIntegration) is passed directly to the pty host without going through the DTO serialization.

In addition to the issue described above, debug terminals were reused across different working directories, causing stale environment activations from previous debug sessions to persist. I added cwd to the terminal config key used for matching, so terminals are only reused when the shell type and working directory both match, so each project directory gets its own debug terminal with the correct activated Python environment.

This PR was manually tested with ./scripts/code.sh --remote test+test

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.

Shell integration not injected for debug terminals in remote environments

2 participants