microsoft / microsoft/intelligent-terminal

Startup shell-integration reconcile unnecessarily starts all WSL distros

Open
#613 2 comments 0 reactions 0 assignees View on GitHub
Issue-Feature Needs-Tag-Fix
Dominant language
C++
Stars
2k
Forks
159
Avg merge
21h 42m
Merged PRs (30d)
120

Description

### Description of the new feature

Provide an option to probe base on usage-gated, not just profile-gated.

Every time Intelligent Terminal starts, it starts **all** installed WSL distributions — not just the ones the user has WSL tabs for. For WSL distros with `systemd` enabled (e.g. Podman WSL, Ubuntu with systemd), this means background services are permanently brought up on every Terminal launch, consuming memory and CPU indefinitely. The user never opened a WSL tab; they just launched PowerShell or any other non-WSL profile.

### Proposed technical implementation details

Options:

1. **Defer probing to first tab open**: only probe a WSL distro when the user actually opens a WSL tab. Install shell integration lazily on first use. This avoids the startup cost entirely for distros the user never opens.

2. **Registry-only identity resolution**: obtain `$WSL_DISTRO_NAME` from the registry (`HKCU\...\Lxss\\DistributionName`) without spawning `wsl.exe`. Defer `$HOME` resolution (the only thing that requires VM access) to first tab open or first UNC path access. This eliminates the VM boot on startup while preserving correctness.

3. **Persist probe cache across launches**: write the resolved `$WSL_DISTRO_NAME` / `$HOME` to a small state file so subsequent Terminal launches skip the probe for distros that were already resolved. This reduces the cost to one-time per distro per machine, not per process.

Option 1 or 2 would eliminate the unwanted WSL startup entirely. Option 3 would reduce it to a one-time cost.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the startup shell-integration reconcile path described in the issue and determine how it enumerates and probes WSL distributions. Compare the three proposed approaches with the maintainers, then verify that launching a non-WSL profile does not start unused distributions while WSL tabs still receive shell integration when opened.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
cli, operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.