Regression: Shell integration is disabled on Windows 10 build 17763 (1809) even though ConPTY is supported
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Summary
VS Code refuses to inject shell integration on Windows 10 **build 17763** (1809) because of a hard-coded minimum build check of **18309** (1903) in `getShellIntegrationInjection()`. But, ConPTY — which shell integration depends on — is available since build **17763** (1809). The overly conservative threshold disables shell integration for all terminals on 1809, including the Copilot "run in terminal" tool, which then falls back to idle-based command detection and shows the "Enable shell integration" banner.
## Environment
- **OS:** Windows 10 Pro N, build 17763 (1809) — `10.0.17763`
- **VS Code:** 1.132.0 (stable)
- **Shell:** PowerShell 7.6.3
- **Terminal profile:** default `PowerShell 7` profile (path-only, no custom args)
- **Copilot Chat Extension:** 0.48.1
## Steps to Reproduce
1. On Windows 10 build 17763 (1809), open any integrated terminal (or use the Copilot "run in terminal" tool).
2. Observe the terminal status / banner: **"Enable shell integration"**.
3. Check the terminal log (`%APPDATA%\Code\logs\\terminal.log`):
```
ToolTerminalCreator#createTerminal: Waiting 4999ms for shell integration
ToolTerminalCreator#_waitForShellIntegration: Timed out 4999ms, using no SI
RunInTerminalTool: shellIntegrationQuality=none at banner decision time
```
4. Inspect the terminal process environment — the injection variables are missing:
| Variable | Expected on success | Observed |
|----------|--------------------|----------|
| `VSCODE_INJECTION` | `1` | *(empty)* |
| `VSCODE_STABLE` | `1` | *(empty)* |
| `VSCODE_A11Y_MODE` | `0` | *(empty)* |
| `VSCODE_NONCE` | set | set (set even on failure) |
## Expected Behavior
Shell integration should be injected on Windows 10 build 17763 (1809), since ConPTY (`CreatePseudoConsole`) is available since that build. The terminal should report `shellIntegrationQuality=rich` and use OSC 633 command detection.
## Actual Behavior
Shell integration injection is skipped. The terminal reports `shellIntegrationQuality=none`, shows the "Enable shell integration" banner, and falls back to idle-based command detection (imprecise, ~1s polling).
## Root Cause
In `src/vs/platform/terminal/node/terminalEnvironment.ts`, `getShellIntegrationInjection()` has:
```ts
// Shell integration requires Windows 10 build 18309+ (ConPTY support)
const windowsBuildNumber = isWindows ? await getWindowsBuildNumberAsync() : 0;
if (isWindows && windowsBuildNumber < 18309) {
return { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedWindowsBuild };
}
```
The comment says "ConPTY support", but ConPTY is available since **build 17763** (1809), not 18309 (1903). See the [ConPtyShell documentation](https://docs.microsoft.com/en-us/windows/console/createpseudoconsole):
> **NOTE:** ConPtyShell uses the function `CreatePseudoConsole()`. This function is available since Windows 10 / Windows Server 2019 version 1809 (build 10.0.17763).
The `18309` threshold is therefore many builds too high and needlessly disables shell integration on 1809.
## Additional Evidence
- The same check exists in the agent host path (`src/vs/platform/agentHost/node/agentHostTerminalManager.ts`), so agent-host terminals are affected too.
- The PowerShell Extension (`ms-vscode.powershell`) works around this by manually setting `VSCODE_INJECTION: "1"` in its terminal env and passing the shell integration script path to `Start-EditorServices` — confirming the scripts themselves work fine on 17763.
- Manually sourcing `shellIntegration.ps1` in a pwsh session on 17763 works correctly (sets `__VSCodeState`, clears `VSCODE_NONCE`), confirming the script is not the problem — only the build gate.
## Suggested Fix
Lower the minimum Windows build check from `18309` to `17763` in:
- `src/vs/platform/terminal/node/terminalEnvironment.ts` (`getShellIntegrationInjection`)
- `src/vs/platform/agentHost/node/agentHostTerminalManager.ts` (same check)
```ts
if (isWindows && windowsBuildNumber < 17763) {
return { type: 'failure', reason: ShellIntegrationInjectionFailureReason.UnsupportedWindowsBuild };
}
```
## Workaround
Until fixed upstream, the compiled JS can be patched:
- `resources\app\out\vs\platform\terminal\node\ptyHostMain.js`
- `resources\app\out\vs\platform\agentHost\node\agentHostMain.js`
Replace `18309` with `17763` in the injection gate and ConPTY usage checks.
Contributor guide
Assessment
This issue has not been assessed yet.