Terminal scrollback lost mid-session on WSL2 + Windows Terminal (alternate screen buffer)
Description
Terminal scrollback gets completely lost during active sessions. Earlier conversation turns become inaccessible when scrolling up, even with large scrollback buffers configured. This started happening around v2.1.87+.
Environment
- Claude Code version: 2.1.90
- Model: Opus 4.6 (1M context) with Claude Max
- Terminal: Windows Terminal (v1.x, historySize: 999999)
- OS: WSL2 (Ubuntu) on Windows 11
- Shell: bash
What I've tried (none worked)
- Increased Windows Terminal
historySizeto 999999 - Ran inside
tmuxwithhistory-limit 50000+alternate-screen off - Set
CLAUDE_CODE_NO_FLICKER=1 - Set
DISABLE_AUTO_COMPACT=1to rule out context compression - Tested with both the legacy conhost and Windows Terminal
Reproduction
- Start a Claude Code session in WSL2 via Windows Terminal
- Have several exchanges with long outputs (e.g., research results, code dumps, table outputs)
- After ~5-10 exchanges, try scrolling up
- Earlier conversation turns are gone from scrollback — the buffer simply doesn't go back far enough
Expected behavior
Full session output should remain scrollable in the terminal throughout the session, as it was in versions prior to ~2.1.87.
Likely cause
Claude Code uses the alternate screen buffer, which bypasses the terminal emulator's normal scrollback. The alternate screen's internal viewport doesn't scale with session length. This is consistent with #42340 and #42002 which describe the same root cause on macOS.
Impact
Makes it impossible to review earlier parts of a session. The conversation context is preserved internally (Claude can reference earlier turns), but the user cannot visually review them. This is especially painful in long research/implementation sessions where referring back to earlier outputs is essential.
Related issues
- #42340 — Terminal scrollback wiped during session (macOS)
- #42002 — Terminal scrollback not working in long sessions (macOS)
- #2479 — Avoid clearing the terminal scrollback
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗