You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(web): Cmd+F in the right panel reaches Files search on a new thread - #35165
Follow-up to #34346, which made Cmd+F anywhere in the right panel focus the Files tab search.
Problem
On a new thread (a draft route), that panel-wide Cmd+F does nothing. For example, Cmd+T → F leaves focus on +, and Cmd+F then has no effect. It works on a saved thread.
previewCommand dispatches the preview action only when the route is a saved thread, so on a draft route the action is dropped.
Change
previewCommand takes the environment from the route: the thread's environment for a saved thread, the draft session's environment for a draft. It then runs the same AuthPreviewOperateScope check and dispatches the action.
The same gate covers the other preview shortcuts (refresh, zoom in/out/reset, focus URL), so those now also reach a Browser tab on a draft thread. No focus is moved when a tab is picked from +; that stays as #34346 left it.
Scope
One small fix for an obvious bug in apps/web, no contract or server change. #35164 has the steps and diagnosis.
Verification
Failing test first: apps/web/src/shortcuts/chatRouteCommands.test.ts, "find reaches the panel on a $route", for a saved and a draft thread. The draft case fails on main (dispatchPreviewAction not called) and passes with the fix.
vp run check:changed → format, lint, knip, tests, React Compiler pass. Typecheck reports 75 errors in my local install, the same 75 on unmodified main, none in the changed files.
Manual QA in the desktop dev build (vp run dev:desktop) on macOS, on a draft thread: Cmd+T → F → Cmd+F now focuses Search files (before: nothing). On a saved thread it still works.
Not checked: Windows/Linux key handling, the packaged desktop app, and the Browser shortcuts on a draft thread.
Implemented with Claude Opus 5.5 in Claude Code (via T3 Code).
Macroscope's review found this PR approvable — New-thread routes can now forward right-panel shortcuts to Files search using the draft’s environment. The existing environment-scope check remains in place, and the change is limited to UI command routing.
You can add or adjust custom eligibility rules. Learn more.
Reviewing files that changed from the base of the PR and between 1b3d788 and b735bb0.
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
No actionable comments were generated in the recent review.
Walkthrough
Preview commands now resolve an environment from either a saved-thread route or a draft-session route. When an environment and preview-operation permission are available, the commands dispatch. Tests cover the find command for both route types.
Changes: Preview commands
Layer / File(s)
Summary
Route environment resolution and command tests apps/web/src/shortcuts/chatRouteCommands.ts, apps/web/src/shortcuts/chatRouteCommands.test.ts
Preview commands resolve the environment from a server-thread reference or a matching draft session. Tests verify that preview.find dispatches for saved-thread and draft-thread routes.
The change lets preview shortcuts such as Cmd+F reach the preview panel on draft threads, as they already do on saved threads. No actionable merge-blocking risk remains. Browser shortcuts on draft threads and Windows/Linux key handling were not manually checked, which is normal pre-merge validation uncertainty rather than an identified defect.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix: Cmd+F in the right panel reaches Files search on a new (draft) thread. The raw summary and objectives confirm the change makes preview commands resolve the environment from dr…
Description check
The description follows the template. It has Problem, Change, Scope, and Verification sections. The problem is clear: on a draft route, the panel-wide Cmd+F is dropped because previewCommand dispatche…
Linked Issues check
[#35164] Requirement: Cmd+F in the right panel must reach the Files tab search on a draft thread. The reviewed head changes previewCommand in apps/web/src/shortcuts/chatRouteCommands.ts. It now re…
Out of Scope Changes check
The whole-PR diff against the merge base dd9c2f8e21 touches two files: apps/web/src/shortcuts/chatRouteCommands.ts (the previewCommand gate) and `apps/web/src/shortcuts/chatRouteCommands.test.ts…
Full details: Title check
Explanation
The title names the fix: Cmd+F in the right panel reaches Files search on a new (draft) thread. The raw summary and objectives confirm the change makes preview commands resolve the environment from draft routes, so the title matches the main change. It is specific and follows the conventional commit style the template asks for.
Full details: Description check
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The problem is clear: on a draft route, the panel-wide Cmd+F is dropped because previewCommand dispatches only for saved threads. The change, scope, and verification are concrete. It links issue #35164 and names the failing-then-passing test, the typecheck baseline, and the manual macOS QA. It also states what was not checked. Minor gaps: the Scope section does not say why the fix needs no issue, but the issue link covers that. The Verification section includes the agent attribution the template asks for.
Full details: Linked Issues check
Explanation
[#35164] Requirement: Cmd+F in the right panel must reach the Files tab search on a draft thread. The reviewed head changes previewCommand in apps/web/src/shortcuts/chatRouteCommands.ts. It now resolves the environment from readRouteTarget(): the thread's environmentId for a server route, and useComposerDraftStore.getState().getDraftSession(draftId)?.environmentId for a draft route. It then runs the existing canOperatePreview check and calls dispatchPreviewAction(action). Before this change, the draft route returned null from readRouteThreadRef, so the action was dropped. The same gate covers preview.refresh, focusUrl, zoomIn, zoomOut, resetZoom, and find, which the issue names as also affected. The added test in chatRouteCommands.test.ts ('find reaches the panel on a $route') covers saved and draft routes and asserts dispatchPreviewAction receives "find". The author reports the draft case failed on main and passes with the fix. I did not run the test. Focus movement inside the Files tab after dispatch is handled by existing code that this diff does not touch. The author reports a manual macOS check; I did not verify it. Windows/Linux key handling was not checked, as the PR states.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base dd9c2f8e21 touches two files: apps/web/src/shortcuts/chatRouteCommands.ts (the previewCommand gate) and apps/web/src/shortcuts/chatRouteCommands.test.ts (a new parameterized test for preview.find on saved and draft routes). The test imports are the mocks the test needs. No contract, server, or unrelated UI change appears. The extra reach to refresh, zoom, and focus URL on draft threads follows from the same gate and is named in #35164 as an affected behavior, so it is not out of scope. The PR states that focus is not moved when a tab is picked from +, which matches the code diff.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 7d3635e and 1b3d788.
Files selected for processing: 2
apps/web/src/shortcuts/chatRouteCommands.test.ts
apps/web/src/shortcuts/chatRouteCommands.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Real web client, Chromium on Linux, 1280×800, light theme; fresh synthetic state on each commit. Ctrl is the platform equivalent of Cmd.
On both commits, open Files with Ctrl+T then F, leaving focus on +, then press Ctrl+F. Run first on a saved thread, then on a new thread without sending a message. Saved threads focus Search files on both commits. The draft keeps focus on + before the fix and focuses Search files after it. scenarios:prove exited 0.
Thanks for this. Main has the change since #35189.
Compared the complete diff of #35165 with the merged change and current main: both resolve the environment from either the saved thread or draft session, preserve the same permission check, and dispatch find, refresh, focus URL, and zoom actions. Main now provides all behavior proposed by this PR; its remaining differences are test coverage and equivalent code organization.
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
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
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.
Resolves: #35164
Follow-up to #34346, which made Cmd+F anywhere in the right panel focus the Files tab search.
Problem
On a new thread (a draft route), that panel-wide Cmd+F does nothing. For example, Cmd+T → F leaves focus on +, and Cmd+F then has no effect. It works on a saved thread.
previewCommanddispatches the preview action only when the route is a saved thread, so on a draft route the action is dropped.Change
previewCommandtakes the environment from the route: the thread's environment for a saved thread, the draft session's environment for a draft. It then runs the sameAuthPreviewOperateScopecheck and dispatches the action.The same gate covers the other preview shortcuts (refresh, zoom in/out/reset, focus URL), so those now also reach a Browser tab on a draft thread. No focus is moved when a tab is picked from +; that stays as #34346 left it.
Scope
One small fix for an obvious bug in
apps/web, no contract or server change. #35164 has the steps and diagnosis.Verification
apps/web/src/shortcuts/chatRouteCommands.test.ts, "find reaches the panel on a $route", for a saved and a draft thread. The draft case fails onmain(dispatchPreviewActionnot called) and passes with the fix.vp run check:changed→ format, lint, knip, tests, React Compiler pass. Typecheck reports 75 errors in my local install, the same 75 on unmodifiedmain, none in the changed files.vp run dev:desktop) on macOS, on a draft thread: Cmd+T → F → Cmd+F now focuses Search files (before: nothing). On a saved thread it still works.Not checked: Windows/Linux key handling, the packaged desktop app, and the Browser shortcuts on a draft thread.
Implemented with Claude Opus 5.5 in Claude Code (via T3 Code).
🤖 Generated with Claude Code