Repository navigation
Conversation
The second Escape reset the footer straight back to "esc interrupt", and nothing else changed until the server finished cancelling the turn and the session status went idle. Under load that gap is long enough that the press looks ignored, so users keep pressing. The double press now sets an "aborting…" state for the session before the abort request is sent, shown in place of the interrupt hint. It clears when the session goes idle. If the request fails it clears with an error toast, and if the session is still running 15s later it clears with a warning so the user knows to press again. AI-Tool: opencode 1.18.34-vt-126-907b3bc518 AI-Model: anthropic/claude-opus-5-5 AI-Variant: high AI-Platform: linux AI-Harness: Vibeterm 52e9db3 AI-Session-ID: ses_eec446a24ffebz6buEl7LB2m3O
Interrupting a running session took two Escape presses, counted by the `session.interrupt` command itself. Binding another key to `session_interrupt` therefore still needed two presses, and there was no slash command for it. Add a `session.abort` command that aborts on one press. Its keybind is `session_abort`, which accepts several keys like every other keybind. It is also available as `/abort` and in the command palette. Its bindings are active only while the session is running, so a key shared with the input, such as ctrl+k (delete to end of line), keeps its editing meaning while the session is idle. `/abort` on an idle session shows a toast instead of being sent as a prompt. The default is alt+escape, which also fixes a double Escape that is silently dropped. A terminal sends Escape as a bare ESC byte, so two presses that reach the TUI in one read parse as a single alt+escape, and three or more as an unnamed key. That happens when the main thread is busy rendering while the user presses, and with one `tmux send-keys Escape Escape` call. None of those keys matched `escape`, so the interrupt never counted. A run of three or more ESC bytes now also resolves to alt+escape, so any burst of Escape presses aborts. AI-Tool: opencode 1.18.34-vt-126-907b3bc518 AI-Model: anthropic/claude-opus-5-5 AI-Variant: high AI-Platform: linux AI-Harness: Vibeterm 52e9db3 AI-Session-ID: ses_eec446a24ffebz6buEl7LB2m3O
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
This branch has not been deployed
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.
Issue for this PR
Closes #53653
Stacked on #53655. The first commit belongs to that PR; this PR adds the second commit.
Type of change
What does this PR do?
session.abortcommand that aborts on one press, with a newsession_abortkeybind (defaultalt+escape). Like any other keybind it accepts several keys, e.g."alt+escape,ctrl+k". The bindings are registered only while the session is running, so a key shared with the input (ctrl+k deletes to end of line) still edits while the session is idle./abortand in the command palette, without starting a turn. On an idle session it shows a toast instead.alt+escape, and three or more as a key with no name. That happens when the main thread is busy while the user presses, and with a singletmux send-keys Escape Escape.session.interruptnever saw either key, so the turn kept running. Withalt+escapeas the default, two coalesced presses now abort, and a small event-match resolver inkeymap.tsxmaps a run of three or more ESC bytes toalt+escapeas well.session.interruptand its two-press behavior are unchanged.How did you verify your code works?
bun typecheck, andbun testinpackages/tui(195 pass). The new keymap test feeds one, two and four ESC bytes and ctrl+k in single reads and checks which ones reachsession.abort.Ran the TUI from source with isolated XDG dirs in a throwaway tmux server, against a local fake provider that streams a long reply and logs when the client disconnects. To simulate a busy main thread, I sent SIGSTOP to the TUI process for the whole time both presses arrived, then resumed it.
aborting…96-192ms after resumetmux send-keys Escape Escape(one write)session_abort: "alt+escape,ctrl+k"), under loadaborting…40-98ms, idle 140-179ms/abort+ Enteraborting…102-125ms, idle 159-188msScreenshots / recordings
Footer after resuming a TUI that was blocked across Esc Esc:
Checklist