fix(tui): restore ESC interrupt for delegated subagent sessions#32767
fix(tui): restore ESC interrupt for delegated subagent sessions#32767tobwen wants to merge 2 commits into
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR:
This appears to be related since it also addresses interrupting subagent sessions. However, PR #32425 seems to be a broader feature implementation for subagent interruption, while PR #32767 (the current PR) is a bug fix restoring ESC key functionality that regressed. They may be complementary rather than duplicates, but worth reviewing to ensure they don't conflict or overlap in scope. |
|
While #32425 is the real deal (steer, cancel, abort, transcript markers) this PR is more lightweight. |
62183f4 to
53c1348
Compare
|
@simonklee @nexxeln @rekram1-node I'm sorry to address you directly like this, but I'm truly convinced that this little feature is very useful for all users. If you start multiple subagents or reviewers and one or two of them get stuck in a loop, for example (we're looking at you, Kimi), it makes a lot of sense to cancel them selectively. This is a regression, since the feature was already available in the past. Could one of you please take a look at this? |
94b7788 to
b1ccd4a
Compare
cec6d3e to
3889c01
Compare
c5e40e4 to
f750a86
Compare
ESC could not stop delegated subtasks because the session.interrupt binding was only registered inside the prompt composer, which is hidden for child sessions. Subagent sessions had no ESC handler at all. Add a dedicated useBindings layer in the session route that remaps the configured session.interrupt key (default: Escape) to a new command session.child.interrupt, scoped to child sessions that are not idle. Double-press logic (first press arms a 5 s timer, second press fires session.abort) mirrors the parent prompt behavior. On abort the pending permission and question entries for the subagent are cleared immediately so the parent thread does not deadlock. The SubagentFooter shows dynamic 'esc interrupt' / 'esc again to interrupt' feedback with the actual bound key.
f750a86 to
34c75e8
Compare
Issue for this PR
Closes #3699 and #4073 and #23534
Type of change
What does this PR do?
This fixes a regression. The functionality was there before and has gone some releases ago.
ESCcould not stop delegated subtasks because the session.interrupt binding was only registered inside the prompt composer, which is hidden for child sessions. Subagent sessions had noESChandler at all (but they had in the past).Add a dedicated useBindings layer in the session route that remaps the configured
session.interrupt key(default:Escape) to a new command session.child.interrupt, scoped to child sessions that are not idle.Well-known double-press logic (first press arms a 5 s timer, second press fires session.abort) mirrors the parent prompt behavior. On abort the pending permission and question entries for the subagent are cleared immediately so the parent thread does not deadlock.
The
SubagentFootershows dynamicesc interrupt/esc again to interruptfeedback with the actual bound key.How did you verify your code works?
Compiled & battle tested.
Screenshots / recordings
UPDATE: Upon requestion, I'm using
escapenow (OpenTUI default). Also, I'm writingInterrupt escape(keybind on the right side). So it matches the existing keybinds.Checklist