[BUG] Terminal UI not cleaned up after exit over SSH — shell prompt renders inside Claude TUI remnants

Resolved 💬 4 comments Opened Apr 8, 2026 by justintime4tea Closed May 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

After exiting Claude Code via Ctrl-C (twice) over SSH, the TUI is not cleaned up. The shell prompt renders inline within the Claude Code UI decorations (input box borders, status bar lines) instead of on a clean line below. It appears the alternate screen buffer is not being properly restored on exit.

Reproduces across all tested terminal emulators on the host (Alacritty on Mac, macOS Terminal), with and without Zellij multiplexer, and with both TERM=alacritty and TERM=xterm-256color (host environment).

Does not occur when running Claude Code locally on macOS

Hacky Workaround
Alias claude to explicitly reset text attributes, ensure cursor visible, and prints several newlines.

alias claude='command claude; printf "\e[0m\e[?25h\n\n\n\n"'

Other workarounds could be to create an alias where clear is called after running claude but this ends up clearing the entire terminal which isn't as "nice".

alias claude='claude;clear'
# OR nuclear - fully reinitialize the terminal
alias claude='claude;reset'

What Should Happen?

Terminal should be fully restored after exit — no TUI remnants, prompt on a clean line (same as local macOS behavior)

Error Messages/Logs

None

Steps to Reproduce

  1. SSH into a Linux host from any terminal
  2. Run claude
  3. Press Ctrl-C twice to exit
  4. Shell prompt appears embedded inside the leftover TUI decorations

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.96

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

Environment

Host

  • OS: MacOS
  • Terminal: Alacritty
  • TERM env: alacritty
  • Shell: zsh 5.9 (arm-apple-darwin24.2.0)

Guest (Fedora/Linux via SSH)

  • Claude Code: 2.1.96
  • OS: Fedora 42 (Linux 6.18.6-100.fc42.x86_64)
  • Shell: bash 5.2.37
  • TERM: alacritty (terminfo installed) — also reproduces with xterm-256color
  • Node: v22.21.1
  • Connection: SSH from macOS Alacritty terminal
  • Install method: curl -fsSL https://claude.ai/install.sh | bash
  • COLORTERM: unset (not forwarded over SSH)
  • TERM_PROGRAM: unset (not forwarded over SSH)
  • LANG: en_US.UTF-8
  • Terminal size: 80x24
  • Not inside tmux/screen on the remote host

Tested Combinations (all reproduce over SSH)

  • Alacritty on macOS + Zellij → SSH → Fedora
  • Alacritty on macOS (no multiplexer) → SSH → Fedora
  • macOS Terminal.app → SSH → Fedora

Does NOT reproduce

  • Running Claude Code locally on macOS

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗