Skip to content

Add stop thread keybinding command - #4308

Open
jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/add-stop-thread-keybinding
Open

Add stop thread keybinding command#4308
jakeleventhal wants to merge 7 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/add-stop-thread-keybinding

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Screen.Recording.2026-07-22.at.4.36.45.PM.mov
  • add a typed thread.stop keybinding command without assigning a default shortcut
  • expose all static commands, including unbound ones, in the keybinding picker
  • route the command through the focused thread's existing turn-interrupt behavior

Testing

  • 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 typecheck in packages/contracts
  • vp run typecheck in apps/web
  • targeted vp fmt --check and vp lint for all changed files
  • integrated browser verification with a real running Codex turn and a custom thread.stop binding; the turn returned to ready with no active turn or error

Note

Add thread.stop keybinding command to interrupt running thread turns

  • Introduces buildRunningThreadTurnInterruptInput in ChatView.logic.ts, which returns a turn interrupt input only when both the current phase and thread session status are running; otherwise returns null
  • Updates ChatViewContent in ChatView.tsx to handle the thread.stop keybinding: it ignores auto-repeated keydowns, checks canInterruptRunningThread, and invokes interruptThreadTurn using the active thread's environmentId
  • Registers thread.stop in THREAD_KEYBINDING_COMMANDS in keybindings.ts so schemas and validators accept it; it is unassigned by default
  • Extends keybinding resolution context with previewFocus and previewOpen flags, allowing thread.stop (and other commands) to be conditionally guarded on preview state
  • Behavioral Change: the old onInterrupt always built input via buildThreadTurnInterruptInput using the environmentId prop; it now uses interruptContextRef and the active thread's environmentId, so interrupt requests target the currently active thread rather than a static prop

Macroscope 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 when rules could still interrupt unexpectedly.

Overview
Adds a thread.stop keybinding 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.stop in the global keydown path: it only runs when buildRunningThreadTurnInterruptInput says the UI phase and thread session are both running (including before activeTurnId is projected), ignores key repeat, and calls the existing interruptThreadTurn flow with errors surfaced on the active thread. Turn-interrupt input building is tightened so a running session without a projected turn omits turnId instead of sending a stale id.

Shortcut resolution context now includes previewFocus and previewOpen, so custom when clauses 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.stop appears there but stays out of DEFAULT_RESOLVED_KEYBINDINGS.

User docs note that thread.stop is unassigned by default.

Reviewed by Cursor Bugbot for commit 2722997. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 656f1296-54e7-490e-8b5a-242f03656535

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jul 22, 2026
@jakeleventhal
jakeleventhal marked this pull request as ready for review July 22, 2026 20:40
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
@macroscopeapp

macroscopeapp Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 2722997

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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/web/src/components/ChatView.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx Outdated
Comment thread packages/contracts/src/keybindings.ts
Comment thread apps/web/src/components/ChatView.tsx
Comment thread apps/web/src/components/ChatView.tsx
@jakeleventhal
jakeleventhal force-pushed the t3code/add-stop-thread-keybinding branch from 47f88dd to ef70dec Compare August 10, 2026 20:28
Comment thread apps/web/src/components/ChatView.tsx
@t3dotgg t3dotgg added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Aug 24, 2026
@jakeleventhal
jakeleventhal force-pushed the t3code/add-stop-thread-keybinding branch from 28efa1f to 8944667 Compare August 26, 2026 02:30
Comment thread apps/web/src/components/ChatView.tsx
@jakeleventhal
jakeleventhal force-pushed the t3code/add-stop-thread-keybinding branch from 8944667 to ab07696 Compare August 26, 2026 02:37
Comment thread apps/web/src/components/ChatView.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread apps/web/src/components/ChatView.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants