Skip to content

fix(web): Cmd+F in the right panel reaches Files search on a new thread - #35165

Closed
armanarutiunov wants to merge 2 commits into
pingdotgg:mainfrom
armanarutiunov:panel-find-draft
Closed

armanarutiunov wants to merge 2 commits into
pingdotgg:mainfrom
armanarutiunov:panel-find-draft

Conversation

@armanarutiunov

Copy link
Copy Markdown
Contributor

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.

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

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 12, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 1b3d788

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.

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

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

Change: Bug fix · Severity of issue fixed: Low

Suggested labels: bugfix

Suggested reviewers: juliusmarminge, t3dotgg

Merge Risk: Minimal · previous review 1b3d7

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed [#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 Passed 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
Recent review info

Run configuration

Commits

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.

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Capture Before: 3a815e9749 After: b735bb0ca3
Saved-thread control Before: saved-thread search focused After: saved-thread search focused
Draft before Find Before: draft plus focused After: draft plus focused
Draft after Find Before: focus remains on plus After: Search files focused
Failure capture Before: draft search remains unfocused Passed
Recording Before interaction After interaction

Scenario driver. Recordings omit startup and pairing screens; shortcut interactions are preserved.

AI-assisted; verified with the tests and tools listed above.

Not shown:

  • Native macOS Cmd-key and Electron-shell behavior were not exercised; this proof covers the shared web shortcut using Ctrl on Linux.
  • Refresh, zoom, and focus-URL preview commands on draft routes were not exercised because this scenario targets Files search.

@juliusmarminge

Copy link
Copy Markdown
Member

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.

Closing as superseded.

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:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cmd+F in the right panel does nothing on a new thread

2 participants