Add stop thread keybinding command - #4308
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a small, opt-in keybinding that exposes an existing turn-interrupt action without changing default shortcuts or stored configuration behavior. The running-state guards, repeat handling, context support, and focused tests keep the production impact bounded. You can add or adjust custom eligibility rules. Learn more. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7ae04963d6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b98d4ac1e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b98d4ac to
130ddd2
Compare
47f88dd to
ef70dec
Compare
28efa1f to
8944667
Compare
8944667 to
ab07696
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ee284b0. Configure here.

Summary
Screen.Recording.2026-07-22.at.4.36.45.PM.mov
thread.stopkeybinding command without assigning a default shortcutTesting
vp test run packages/contracts/src/keybindings.test.ts apps/web/src/keybindings.test.ts apps/web/src/components/settings/KeybindingsSettings.logic.test.ts(58 tests)vp run typecheckinpackages/contractsvp run typecheckinapps/webvp fmt --checkandvp lintfor all changed filesthread.stopbinding; the turn returned toreadywith no active turn or errorNote
Add
thread.stopkeybinding command to interrupt running thread turnsbuildRunningThreadTurnInterruptInputin ChatView.logic.ts, which returns a turn interrupt input only when both the current phase and thread session status arerunning; otherwise returns nullChatViewContentin ChatView.tsx to handle thethread.stopkeybinding: it ignores auto-repeated keydowns, checkscanInterruptRunningThread, and invokesinterruptThreadTurnusing the active thread'senvironmentIdthread.stopinTHREAD_KEYBINDING_COMMANDSin keybindings.ts so schemas and validators accept it; it is unassigned by defaultpreviewFocusandpreviewOpenflags, allowingthread.stop(and other commands) to be conditionally guarded on preview stateonInterruptalways built input viabuildThreadTurnInterruptInputusing theenvironmentIdprop; it now usesinterruptContextRefand the active thread'senvironmentId, so interrupt requests target the currently active thread rather than a static propMacroscope summarized ee284b0.
Note
Medium Risk
New keyboard path can cancel in-flight agent turns; behavior is gated on running state but mis-bound shortcuts or
whenrules could still interrupt unexpectedly.Overview
Adds a
thread.stopkeybinding command (typed in contracts, no default shortcut) so users can interrupt the active turn from the keyboard when they assign a binding in Settings.ChatView handles
thread.stopin the global keydown path: it only runs whenbuildRunningThreadTurnInterruptInputsays the UI phase and thread session are bothrunning(including beforeactiveTurnIdis projected), ignores key repeat, and calls the existinginterruptThreadTurnflow with errors surfaced on the active thread. Turn-interrupt input building is tightened so a running session without a projected turn omitsturnIdinstead of sending a stale id.Shortcut resolution context now includes
previewFocusandpreviewOpen, so customwhenclauses can gate commands (including stop) on preview state. The keybinding picker is expected to list all static commands, not only ones with default bindings—thread.stopappears there but stays out ofDEFAULT_RESOLVED_KEYBINDINGS.User docs note that
thread.stopis unassigned by default.Reviewed by Cursor Bugbot for commit 2722997. Bugbot is set up for automated code reviews on this repo. Configure here.