WSL2 falsely detected as having conhost viewport yank bug — streaming text unnecessarily disabled

Open 💬 1 comment Opened Jun 13, 2026 by Xyc2016

Problem

On WSL2 running inside Windows Terminal, Claude Code disables line-by-line streaming text. The entire response appears at once instead of progressively. This was confirmed on Claude Code v2.1.177.

Root Cause

The detection logic checks for WT_SESSION environment variable (injected by Windows Terminal) as a proxy for "output routes through Windows conhost." However, this only applies to WSL1. WSL2 uses a real Linux virtual terminal (/dev/pts) and does NOT route terminal output through conhost. The conhost viewport scrollback yank bug (microsoft/terminal#14774) does not exist on WSL2.

Who is affected

All WSL2 users who run Claude Code inside Windows Terminal. The WT_SESSION env var is automatically injected by Windows Terminal into WSL sessions, causing a false positive.

How to distinguish WSL1 vs WSL2

WSL2 explicitly includes "WSL2" in the kernel version string:

# WSL2:
$ cat /proc/sys/kernel/osrelease
5.15.167.4-microsoft-standard-WSL2

# WSL1 (no WSL2 suffix):
4.4.0-19041-Microsoft

Suggested fix

Add a WSL2 check before disabling streaming:

if (process.platform === "win32") → disable streaming  (native Windows, conhost applies)
if (no WT_SESSION)              → enable streaming   (not Windows Terminal, no conhost)
if (WT_SESSION + WSL2)          → enable streaming   (WSL2 uses /dev/pts, no conhost)
if (WT_SESSION + not WSL2)      → disable streaming  (WSL1 or unknown, assume conhost for safety)

The WSL2 check can be done by reading /proc/sys/kernel/osrelease and checking for the "WSL2" substring.

Workaround

Users can unset WT_SESSION before launching Claude Code:

unset WT_SESSION && claude

Or add to ~/.zshrc:

alias claude='WT_SESSION= command claude'

Related

  • #36862 — Docs missing for streaming disable on WSL
  • #37110 — Reported as a regression
  • #37275 — Feature request for override env var (closed as duplicate)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗