[BUG] Attach to background session never enables mouse tracking — wheel becomes arrow keys (still in 2.1.252, byte-level evidence)

Status Open
Reported on v2.1.144
Maintainer reply None cached
Activity 7 comments · opened Sep 1, 2026

Summary

Attaching to a background session (claude --bg + claude attach <id>, /bg + reattach, or opening one from Agent View) puts the terminal into the alternate screen without ever enabling mouse tracking. Any terminal that implements the alternate-scroll fallback (VS Code integrated terminal, Windows Terminal, most Linux terminals) then converts wheel events into arrow keys, so the wheel cycles input history instead of scrolling the transcript, and Claude Code shows "Scroll wheel is sending arrow keys · use PgUp/PgDn to scroll". Hover/click and Claude-managed select-to-copy are also dead; selection falls back to native terminal copy.

This is the same defect as #59979 (closed as fixed in 2.1.144, but reported as still reproducing in 2.1.176/2.1.183/2.1.195 by multiple users) and #64214 (Linux). I captured the raw bytes each code path writes, on both 2.1.241 and 2.1.252 (latest, build 2026-08-31, c0778c4): the captures are byte-identical in the relevant modes — the bug is still present in 2.1.252.

Environment

  • Claude Code 2.1.241 and 2.1.252 (native installer, win32-x64)
  • Windows 10 Pro 19045
  • Reproduced in the VS Code integrated terminal (TERM_PROGRAM=vscode, 1.134.0) and under a bare ConPTY harness (pywinpty), so this is not VS Code-specific
  • Foreground fullscreen sessions on the same machine work perfectly

Reproduction

  1. claude --bg "anything" → note the session id
  2. claude attach <id> (or open it via claude agents)
  3. Scroll the mouse wheel → arrow keys / prompt-history cycling; the "use PgUp/PgDn" hint appears. PgUp/PgDn do work.

Byte-level evidence (DEC private modes written to the terminal, in order)

Foreground fullscreen session (wheel works):

?1004h ?9001h ?1049h ?1000h ?1002h ?1003h ?1006h ?25l ?2004h ?2031h ?2026h/l …

claude attach to a background session (wheel broken) — identical on 2.1.241 and 2.1.252:

?1004h ?9001h ?1049h ?2004h ?1004h ?2031h ?25l ?2026h/l …        ← no mouse modes at all

The hosted background worker itself (captured via CLAUDE_PTY_RECORD on the PTY host):

?1004h ?2004h ?25l …                                             ← inline renderer: no alt screen, no mouse

Analysis

  • The attach client enters the alt screen and then replays only the DEC private modes the daemon tracked from the hosted worker (the decModes array in the attach ack).
  • The hosted worker always runs the inline renderer, which never enables mouse tracking — so no mouse mode is ever replicated to the attaching terminal.
  • Alt screen active + no mouse tracking is exactly the state where xterm.js/Windows Terminal/etc. fall back to alternate-scroll: wheel → CSI A/CSI B.
  • The existing self-heal (arrow-burst detection → reassertTerminalModes) is a no-op here, because it re-asserts the worker's mouse mode, which is "off".
  • This also explains the macOS/Linux asymmetry in #64214: nothing in the attach path enables mouse reporting, so behavior is entirely determined by each terminal's alt-screen wheel fallback.

Suggested fix directions

  • Have the attach client enable SGR mouse reporting itself (as the foreground fullscreen renderer does) and translate wheel reports into the existing scroll pipeline; or
  • Have the daemon synthesize mouse modes into decModes for attach and route the resulting SGR wheel input to the transcript scroller in the hosted worker.

Happy to provide the full capture logs or run diagnostics on a candidate build — this machine reproduces it 100% of the time.

View original on GitHub ↗

3 Comments

Deathnerd · 19 days ago

Still reproducing on 2.1.282, Windows Terminal + Windows 10 Pro 19045, fullscreen renderer. Session opened from Agent View: the wheel cycles prompt history and moves between the input box and the agent list, and clicking the diff panel's × does nothing. Workaround: close the panel with /diff and scroll with PgUp/PgDn.

liby · 16 days ago

I’m seeing the same symptoms on macOS with Ghostty and Herdr, after moving an existing foreground session to the background:

  1. Run /exit while background tasks are still running.
  2. Choose the option to move the session to the background rather than stop the tasks.
  3. Launch claude again and use /resume to select that conversation.
  4. Accept the prompt to attach to the running session.

After attaching, the mouse wheel cycles through prompt history instead of scrolling the conversation, and Claude Code shows:

Scroll wheel is sending arrow keys · use PgUp/PgDn to scroll

The diff sidebar also appears, but clicking its × does nothing.

Starting Claude Code normally and using /resume without going through the attach prompt has worked for me. The problem appears to be specific to attaching to the background session.

kumaakh · 16 days ago

Still happening on Windows 10: wheel scrolling breaks only when a conversation is opened through claude agents

Environment

  • Claude Code 2.1.283
  • Windows 10 Pro 10.0.19045, Windows PowerShell 5.1 console
  • settings.json: "tui": "default", "env": { "CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN": "1" }

Repro

  1. Run plain claude in a PowerShell console and have a conversation. The mouse wheel and scrollbar scroll the output normally.
  2. Exit, run claude agents, and open the same conversation (or any background session).
  3. The mouse wheel no longer scrolls the conversation output at all.

Expected: Scrolling behaves the same as in plain claude. It's the same conversation, so only the view differs.

Notes

  • A conversation that scrolled fine in plain claude stops scrolling as soon as it's opened from claude agents, so the problem is in the agents/background attach view, not the session.
  • CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 and /tui default fix plain sessions but have no effect here.
  • The attached session's environment shows CLAUDE_CODE_CHILD_SESSION=1 and CLAUDE_CODE_ALT_SCREEN_FULL_REPAINT=1, which suggests the attach path forces the alternate screen whatever the user's settings say.

Impact: This is very, very disruptive. It breaks the user's flow completely. Background agents are meant for long-running interactive work, but once you attach you can't scroll back to read the agent's output, reasoning or diffs. The only workaround is to leave the agents view
and resume the conversation in a plain session, which defeats the point of claude agents. Please prioritize a fix, or at least honor CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN in the attach view.

Showing cached comments. Read the full discussion on GitHub ↗