Kitty: malformed OSC 9 notification '4;0;' emitted on /exit
Description
Every time Claude Code exits (via /exit or /quit), it sends a malformed OSC 9 (ConEmu-style) notification to the terminal. In Kitty, this renders as a desktop notification with the body 4;0;.
Root Cause
Captured via Python pty, the exact byte sequence emitted at exit is:
\e]9;4;0;\a
This is an OSC 9 notification where the payload appears to be structured as <type>;<code>;<message> — but the <message> field is empty. Kitty has no message to display, so it renders the raw parameters (4;0;) as the notification body.
Steps to Reproduce
- Run
claudein Kitty terminal (v0.32.2, Linux) - Type
/exitor/quit - A Kitty desktop notification appears immediately with body
4;0;
This happens on every exit.
Environment
- Claude Code: v2.1.126
- Terminal: Kitty 0.32.2
- OS: Ubuntu (Linux 6.17.0)
TERM:xterm-kittyKITTY_WINDOW_IDis set (Claude Code detects Kitty)
Captured Evidence
Python pty capture (hex), offset 0x4e0 — the exit sequence:
000004e0: 5b72 1b38 1b5d 393b 343b 303b 071b 5d30 [r.8.]9;4;0;..]0
000004f0: 3b07 ;.
Decoded: \e[r (reset scroll region), \e8 (restore cursor), \e]9;4;0;\a (malformed notification), \e]0;\a (clear window title).
Expected Behavior
Either:
- The notification body should contain a meaningful message (e.g. "Session ended"), or
- The OSC 9 notification should not be emitted on exit at all
Workaround
None available on the Kitty side — Kitty 0.32.2 does not expose per-protocol notification suppression. Fix needs to be in Claude Code's exit/cleanup sequence.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗