[BUG] Terminal tab title cleared to empty string on exit despite CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1
Description
I manage my own terminal tab titles manually (via shell functions that emit OSC escape sequences). I set CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 in ~/.claude/settings.json specifically so that Claude Code leaves my tab titles alone. This worked correctly until recent versions.
As of 2.1.68–2.1.70, when I exit Claude Code (via Ctrl+D), my tab title is wiped to an empty string. Since I also have oh-my-zsh's DISABLE_AUTO_TITLE=true set (because I manage titles myself), nothing auto-restores the title — so it stays permanently blank.
Steps to Reproduce
- Set
CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1in~/.claude/settings.json:
``json``
{
"env": {
"CLAUDE_CODE_DISABLE_TERMINAL_TITLE": "1"
}
}
- Set a custom terminal tab title (e.g.
printf '\033]0;My Project\007') - Start a Claude Code session
- Exit with Ctrl+D
- The tab title is now an empty string instead of "My Project"
Expected Behavior
When CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1 is set, Claude Code should not emit any OSC title escape sequences at any point — not on startup, not during the session, and not on exit. The user's terminal title should be completely untouched.
Actual Behavior
On exit, Claude Code sends an OSC escape sequence that clears the terminal title to an empty string, overwriting whatever title the user had set before launching Claude Code.
Likely Cause
Recent versions introduced terminal title features:
- 2.1.6: "Changed terminal title to 'Claude Code' on startup"
- 2.1.69: "Added agent name display in terminal title", "/rename now updates the terminal tab title"
The exit/cleanup code path appears to reset the title without checking the CLAUDE_CODE_DISABLE_TERMINAL_TITLE flag.
Environment
- Claude Code version: 2.1.70
- Platform: macOS (Darwin 24.6.0, arm64)
- Terminal: iTerm2
- Shell: zsh with oh-my-zsh (
DISABLE_AUTO_TITLE=true)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗