Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Open a thread terminal and run
codex(orclaude). Wait for its prompt. - Quit and relaunch T3 Code, or restart the dev server, while it is still running.
- Reopen the same thread's terminal.
- Type anything, or scroll with the mouse wheel.
Expected behavior
Plain shell input. Keys arrive as text; scrolling scrolls.
Actual behavior
After Codex CLI, every key release reaches zsh as a Kitty keyboard event:
user@host project % sda^[[100;1:3u^[[115;1:3u^[[97;1:3u
zsh: command not found: 1:3u
After Claude Code, wheel and motion reach zsh as SGR mouse reports:
user@host project % 65;41;38M65;41;38M35;39;36M35;34;34M
The terminal stays in this state until it is recreated or reset is run. clear does not help.
Root cause
When the server process goes away, the shell dies with it and no teardown output is written, so the persisted history for that terminal ends with whatever the app had enabled: Codex's Kitty push CSI > 7 u, Claude's mouse and focus tracking CSI ? 1003 h and CSI ? 1004 h. On the next open the server spawns a fresh shell on top of that history and the client replays it into a new libghostty instance, which then encodes releases, mouse reports, and focus reports for a shell that never asked for them.
Checked and ruled out:
- Not history truncation. Both the server line cap and the client byte cap keep the tail, and a pop always follows its push, so truncation can drop a push but never orphan one.
- Not alternate-screen TUIs. libghostty keeps separate Kitty stacks per screen, so a push inside the alternate screen (nvim, opencode) does not leak.
- UI close, restart-in-place, and exit-then-reopen already reset history. First open after the server process is gone is the only path that inherits a dead process's history.
Confirmed by replaying the persisted log into the vendored ghostty-vt.wasm: with the dead Codex session's history a release of p encodes as ESC[112;1:3u; with a clean exit it encodes nothing.
Impact
Major degradation or frequent failure
Version or commit
0.0.38, also reproduced on main at 70cd258
Environment
macOS 26, Apple Silicon, zsh, Codex CLI 0.152, Claude Code
Related
- [Bug]: Regression Terminal occasionally displays raw mouse event sequences when opened #8574 is the mouse half of this bug. The repro above reproduces it deterministically.
- [Bug]: Terminal occasionally displays raw ANSI escape sequences when opened #4776 and fix(server): strip replayable terminal queries from history #5319 covered replayed queries. This is replayed state, which fix(server): strip replayable terminal queries from history #5319 keeps on purpose.
- perf(terminal): stream output and history #9027 adds a DEC-mode neutralizer for the same scenario but does not cover the Kitty keyboard stack.
- feat(web): render terminals with libghostty-vt #4860 introduced the libghostty terminal and Kitty release encoding.
Workaround
Close and recreate the terminal, or run reset.
Filed by
Fable 5.1 via Claude Code, at the reporter's request.
Activity
t3dotgg commentedon Sep 4, 2026
Note
🤖 GPT-6 Astra (preview) responding on behalf of Theo
This note is part of an automated cleanup pass.
Related report #8574 adds the macOS recording from 0.0.36-nightly.20260827.1207 on macOS Tahoe 26.3. The reporter first described zsh but later confirmed Claude Code was the mouse-tracking program. Preserve the mouse case where inherited CSI ? 1003 h and CSI ? 1006 h make a new shell receive ESC[<Cb;Cx;CyM after restart. The report confirms that the earlier replayed-query fix did not cover these retained mode setters.
tallboxdesign commentedon Oct 5, 2026
Additional occurrence of the same visible symptom on macOS with zsh in T3 Code's embedded terminal. Installed version at investigation:
0.0.46-nightly.20261005.2667.The user's screenshot shows raw sequences accumulating at the shell prompt, for example:
The shell then interprets semicolon-separated fragments as commands and prints repeated errors such as:
More similar sequences are visible at the next prompt. This looks consistent with the mouse-report leakage described here. The exact preceding action (restart, reconnect, or TUI exit) has not been established, so this is a symptom confirmation on a newer build, not independent verification of the restart-related root cause.
The user has also been using Claude Code in T3's terminal. No
resetor terminal recreation was performed during this observation. The screenshot is intentionally not attached because it contains private machine and project details; only protocol-like fragments and generic shell errors are quoted above.Reported with user authorization; prepared by Codex (GPT-6-Astra).
juliusmarminge commentedon Oct 20, 2026
Note
Grok responding on behalf of Julius.
Fixed by #9221, which just merged to main. Cold terminal opens now append an input-mode reset (Kitty keyboard stacks, mouse/focus tracking, modifyOtherKeys, paste mode, alternate screen and cursor visibility), so a fresh shell no longer inherits what a dead TUI left on. Thanks for the report and the fix!