Skip to content

fix(web): Mod+S stashes a side chat's prompt - #42295

Merged
juliusmarminge merged 2 commits into
mainfrom
factory/issue-42281
Nov 24, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
factory/issue-42281

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Pressing Cmd+S / Ctrl+S in a side chat's composer did nothing: the prompt wasn't stashed and the browser's Save Page default wasn't stopped, though the same key worked in the main chat. The stash shortcut now registers for side-chat composers too and handles keys pressed inside a side-chat pane, while composers of threads hidden under Settings and Usage still stay silent.

Fixes #42281

Reproduction on main

Commit f99ef08 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree, added a project and started a Replay (dev) showcase thread through the CLI, then opened the web app in the preview browser. In the thread's main composer I typed /side what is clamp? and sent it; the side chat opened as a tab in the right panel. I typed 'side draft to stash' in the side chat's composer (focus confirmed inside [data-side-chat-pane]) and pressed Ctrl+S. The draft stayed in the side composer, no Stash badge appeared, and a capture-phase listener showed the keydown's defaultPrevented was false, so nothing stops the browser's Save Page default. As a control I typed 'main draft' in the main composer and pressed Ctrl+S: it was stashed (composer cleared, Stash badge showed 1), and the side composer still held its draft. A browser test added to apps/web/src/components/chat/useComposerStash.browser.test.tsx mounts useComposerStash inside BackgroundThreadContext and a [data-side-chat-pane] element and dispatches Mod+S from a focused element in the pane. It fails on main (defaultPrevented false, no stash entry) and passes when the registration gate is removed.

Evidence

Scenario: Ctrl+S stashes a prompt from the side chat composer

Open a Replay showcase thread, send /side what is clamp?, wait for its reply, type side draft to stash in the side composer, and press Ctrl+S. Environment: Chromium 156 on Linux, 1440×1000, light theme, fresh synthetic data on each commit.

Proven: the scenario fails on base f99ef08bb8 and passes on head d29c5cb5dc.

Before: f99ef08bb8 After: d29c5cb5dc
Result Draft remains; empty-composer assertion fails Composer clears; Stash shows 1; scenario passes
Before shortcut Base draft before shortcut Head draft before shortcut
After shortcut Base draft remains Head composer clears and Stash shows 1
Failure capture Base assertion failure
Recording Before Ctrl+S interaction After Ctrl+S interaction

Scenario source. Recordings are six-second interaction excerpts; the head recording holds its final frame.

Not shown:

  • macOS Cmd+S and the Electron desktop shell were not exercised; this proof covers Ctrl+S in the real web client.
  • Restoring the saved prompt from the Stash menu was not exercised; the proof verifies draft clearing and Stash count 1.

Tests

  • vp test run src/components/chat/useComposerStash.browser.test.tsx without the fix: 1 failed, 1 passed (the side-chat repro test fails)
  • vp test run src/components/chat/useComposerStash.browser.test.tsx with the fix: 2 passed
  • vp run check:changed: format, lint, knip, typecheck, test, react compiler all pass
  • vp test run src/components/chat/useChatShortcuts.browser.test.tsx: 11 passed
  • vp test run src/components/ChatView.browser.test.tsx -t stash: 3 passed
  • PR CI on d29c5cb: all 8 required checks passed

Not in this change

  • If two embedded composers were mounted at once (e.g. several side-chat panes), the newest registered would handle Mod+S from any pane, since the guard matches any [data-side-chat-pane] rather than the composer's own pane.
  • The BackgroundThreadContext doc comment still says side chats' global shortcuts stand down, which is now looser than the stash shortcut's behaviour.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 24, 2026 17:20
Fails on main: useComposerStash skips registering composer.stash under
BackgroundThreadContext, which side chats render inside, so Mod+S in a
side chat neither stashes nor stops the browser's Save Page default.
Repro for #42281.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
useComposerStash skipped registering composer.stash under
BackgroundThreadContext, which side chats render inside, and the main
composer ignores keys from a side chat pane, so Mod+S there reached no
handler. Stand down only under HiddenThreadContext (threads kept mounted
under Settings and Usage), and let an embedded composer take the keys
pressed inside a side chat pane while the main one takes the rest.

Fixes #42281

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The composer stash shortcut now handles Mod+S in side-chat panes. It does not register for hidden threads. A browser test verifies that Mod+S prevents the default action and adds the side chat’s prompt to the stash.

Changes: Composer stash shortcut

Layer / File(s) Summary
Scope shortcut registration to the thread pane
apps/web/src/components/chat/useComposerStash.ts, apps/web/src/components/chat/useComposerStash.browser.test.tsx
The hook skips registration for hidden threads and matches shortcut events to the composer’s pane. The browser test checks that Mod+S stashes a side-chat prompt.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: maria-rcks

Merge Risk: Minimal · up to d29c5

Mod+S in a side-chat composer now stashes its prompt and prevents the browser's Save Page action. Hidden-thread composers stay inactive. No concrete merge-blocking risk was found. The edge case of multiple simultaneously mounted side-chat panes is acknowledged by the author and is unlikely in normal use.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): Mod+S stashes a side chat's prompt" is a conventional commit title that names the primary change. The raw summary and PR objectives both show the change registers the stash shortc…
Linked Issues check Passed Issue #42281 requires Mod+S in a side-chat composer to stash the prompt, as the main composer does, and requires hidden threads under Settings or Usage to stay inactive. The diff in apps/web/src/compo…
Out of Scope Changes check Passed The reviewed changes are limited to useComposerStash.ts (shortcut gate and filter) and its browser test. Both directly implement the side-chat stash shortcut from #42281. The BackgroundThreadContext d…
Description check Passed The description states the problem (Cmd+S/Ctrl+S in a side-chat composer does not stash the prompt or block the browser Save Page default), the change (the stash shortcut registers for side-chat compo…
Full details: Title check

Explanation

The title "fix(web): Mod+S stashes a side chat's prompt" is a conventional commit title that names the primary change. The raw summary and PR objectives both show the change registers the stash shortcut for side-chat composers and handles keys inside a [data-side-chat-pane], while keeping hidden-thread composers inactive. The title matches this main change and does not describe anything absent from the changeset.

Full details: Linked Issues check

Explanation

Issue #42281 requires Mod+S in a side-chat composer to stash the prompt, as the main composer does, and requires hidden threads under Settings or Usage to stay inactive. The diff in apps/web/src/components/chat/useComposerStash.ts meets both parts. It replaces the old gate if (backgroundThread) return; with if (hiddenThread) return; using HiddenThreadContext. It also sets the capture-phase when filter to isInSideChatPane(event.target) === embedded, so a side-chat composer handles keys inside [data-side-chat-pane] and the main composer handles keys outside it. The added browser test in useComposerStash.browser.test.tsx covers the side-chat case. Known gap: with two side-chat panes mounted, the newest registered composer can handle Mod+S from either pane. The issue's expected behavior describes a single side chat, and its matching-to-own-pane point is only a suggested fix. Workflow panes are not claimed by this PR. Real-app before-and-after evidence is still pending.

Full details: Out of Scope Changes check

Explanation

The reviewed changes are limited to useComposerStash.ts (shortcut gate and filter) and its browser test. Both directly implement the side-chat stash shortcut from #42281. The BackgroundThreadContext doc comment is stale, but it is not changed, so it adds no out-of-scope change. The embedded gate also applies to any embedded composer with a [data-side-chat-pane] ancestor, including possibly workflow panes. The PR does not claim workflow pane support, but no workflow-specific change is present. This is a behavior side effect, not an unrelated change.

Full details: Description check

Explanation

The description states the problem (Cmd+S/Ctrl+S in a side-chat composer does not stash the prompt or block the browser Save Page default), the change (the stash shortcut registers for side-chat composers and handles keys inside [data-side-chat-pane], while hidden-thread composers stay silent), and a linked issue (#42281). It has a reproduction on main, a before/after evidence table, and a test list. It follows the template's Problem, Change, Scope, and Verification sections. The Scope section links the issue as the bug report and states the fix is for a bug. The Verification section includes focused test commands and observed results. The description also names the authoring models, which the template asks for. The description has no formal section headings for the template's exact titles, and the title line is missing from the body. Its content is mostly complete, so this check passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between e3ff780 and d29c5cb.

Files selected for processing: 2

  • apps/web/src/components/chat/useComposerStash.browser.test.tsx
  • apps/web/src/components/chat/useComposerStash.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mod+S can't stash a prompt in a side chat's composer, though it works in the main chat

1 participant