fix(web): stop auto-sending Ctrl+L from session selection paths#99
Merged
Conversation
Claude Code 2.x treats Ctrl+L (\x0c) as a two-step "clear conversation" command (first press shows the confirmation prompt, second press clears). The frontend previously fired \x0c from three places to force Ink to redraw stale CUP-positioned frames in the tailed buffer; if a page refresh or SSE reconnect ran the same path twice within Claude's confirmation window the second \x0c silently nuked the user's conversation. Removed the \x0c sends from: - selectSession() — main offender, runs on every tab switch & page reload - restoreTerminalSize() — manual "restore size" button - sendPendingCtrlL() — dead code path (pendingCtrlL was never populated) Trade-off: occasional stale Ink frames immediately after refresh; the user's first keypress causes Ink to redraw and the artifact vanishes. Losing the conversation silently is far worse than a brief cosmetic glitch.
Owner
|
Thank you very much — this is an excellent catch and a really well-reasoned fix. 🙏 Silently wiping the conversation on a fast refresh / SSE reconnect is about the worst failure mode we could have, so trading it for a transient stale Ink frame that self-heals on the next keypress is clearly the right call. I verified the whole change before merging:
Love the "Do NOT re-introduce Ctrl+L here" guard comments too — that'll save a future regression. CI is green. Merging now, thanks again! 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
Quickly refreshing the page (or an SSE reconnect firing in quick succession) would sometimes silently wipe the current conversation — the active Claude session got cleared with no warning or confirmation.
Root cause
Claude Code 2.x treats Ctrl+L (
\x0c) as a two-step "clear conversation" command (first press shows a confirmation prompt, second press clears). The frontend fired\x0cfrom three places to force Ink to redraw stale CUP-positioned frames in the tailed buffer. When a fast page refresh / reconnect ran the same path twice within Claude's confirmation window, the first\x0copened the clear prompt and the second\x0cconfirmed it — destroying the conversation.Fix
Removed the
\x0csends from:selectSession()— the main offender, runs on every tab switch & page reloadrestoreTerminalSize()— manual "restore size" buttonsendPendingCtrlL()— dead code path (pendingCtrlLwas never populated)Trade-off: occasional stale Ink frame immediately after refresh; the user's first keypress causes Ink to redraw and the artifact vanishes. Losing the conversation silently is far worse than a brief cosmetic glitch.
Test plan
app.js/terminal-ui.jscleanly🤖 Generated with Claude Code