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): right-panel shortcuts work on a new, unsent thread - #35189
In apps/web/src/shortcuts/chatRouteCommands.ts, previewCommand (preview.find, refresh, focusUrl, zoomIn/zoomOut/resetZoom) dispatched only when readRouteThreadRef() returned a saved-thread ref. On /draft/$draftId that is null, so the shortcut was claimed (preventDefault/stopPropagation) and then dropped. The gate only needs an environment id for the AuthPreviewOperateScope check, so a new readRouteEnvironmentId() returns it from either route kind: the server thread ref, or the draft session's environmentId from the composer draft store. The permission check is unchanged. The panel listeners (FileBrowserPanel find, PreviewView) do not gate on the thread, so once the action is dispatched, Cmd/Ctrl+F focuses Search files on a draft as it does on a saved thread. The bug was reproduced only through the 3 failing tests on factory/repro-35164; the app was not run in a browser before or after the fix. No new regex or parser. Nothing visual changes beyond the shortcuts now working.
Commit d2b8f29 (origin/main). Ran T3CODE_DEV_SEED=0 vp run dev in a fresh worktree and drove the web client in the preview browser with real key presses (Ctrl as mod on Linux). Draft thread: clicked New thread (route /draft/), opened the right panel (Toggle right panel), pressed F in the surface picker to add a Files tab, focused the + (Add panel surface) button, pressed Ctrl+F. Focus stayed on + ('Add panel surface'); Search files was not focused. Control on a saved-thread route (//) with a Files tab open: focused +, pressed Ctrl+F, and focus moved to 'Search server files'. Note: in the web client, picking Files from the surface picker already focuses its search box, so I moved focus back to + to match the reporter's state. Failing unit tests (preview.find, preview.refresh and preview.focusUrl on a draft route never call dispatchPreviewAction) pushed as factory/repro-35164; they fail 3/7 on main and pass with a minimal gate change, which was reverted.
Evidence
Chromium on Linux, 1280×800, light theme; fresh synthetic state on both commits. Open an unsent new thread → toggle right panel → select Files with F → return focus to + by opening and dismissing its menu → press Ctrl+F.
AI-assisted; verified with the tests and tools listed above.
Not shown:
Refresh, focus URL, and zoom shortcuts were not exercised; this scenario covers the reported Files-search interaction.
macOS Cmd+F and the Electron desktop shell were not exercised; verification used Linux web Ctrl+F.
Tests
vp test run src/shortcuts/chatRouteCommands.test.ts (apps/web): 3 failed / 4 passed without the fix, 7/7 passed with it. vp run check:changed: format, lint, knip, typecheck (2 packages), tests (2 files) and react compiler all pass.
Not in this change
preview.toggle and readPreviewOpen (the previewOpen shortcut context) still require a saved-thread ref. Right-panel state is keyed per saved thread, so toggling the preview on drafts is a separate change.
Failing tests for #35164: preview.find, preview.refresh and preview.focusUrl are dropped on a draft route.
AI-assisted; verified with the tests and tools listed above.
Preview shortcuts (find, refresh, focus URL, zoom) only dispatched on a
saved-thread route, so on /draft/$draftId they were claimed and dropped.
Gate them on the route's environment, which a draft session also carries.
Fixes#35164
AI-assisted; verified with the tests and tools listed above.
Macroscope's review found this PR approvable — Right-panel shortcuts now work on unsent threads using the draft's environment while preserving the existing permission check. The change is limited to existing user-invoked panel actions and leaves saved-thread behavior and product defaults unchanged.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review.
Walkthrough
Preview shortcuts now resolve an environment ID for saved-thread and draft routes. Draft routes with an environment ID can authorize and dispatch preview actions. Tests cover the find, refresh, and focus URL commands on a draft thread.
Changes: Draft-route preview shortcut support
Layer / File(s)
Summary
Resolve route environment and dispatch preview actions apps/web/src/shortcuts/chatRouteCommands.ts, apps/web/src/shortcuts/chatRouteCommands.test.ts
Preview commands use an environment ID from the server-thread route or matching draft session. Parameterized tests verify that find, refresh, and focus URL actions dispatch on a draft route.
Preview shortcuts such as find, refresh, focus URL, and zoom should now work on draft thread routes, with the existing permission check still applied. No merge-blocking issue was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(web): right-panel shortcuts work on a new, unsent thread" follows the conventional commit format and names the primary change. The changeset adds readRouteEnvironmentId so preview.find,…
Linked Issues check
[#35164] The issue requires Ctrl+F/Cmd+F to focus the Files tab Search files box on a draft route, as on a saved thread. The root cause named in the issue is the saved-thread-only gate in previewComma…
Out of Scope Changes check
The whole-PR diff from merge base d2b8f29 to head 0722a83 changes apps/web/src/shortcuts/chatRouteCommands.ts (gate change and new readRouteEnvironmentId helper, +9/-2) and chatRouteCommands.tes…
Description check
The description follows the template well. It states the problem (on /draft/$draftId, previewCommand shortcuts were claimed and then dropped because readRouteThreadRef() returns null), the change (new…
Full details: Title check
Explanation
The title "fix(web): right-panel shortcuts work on a new, unsent thread" follows the conventional commit format and names the primary change. The changeset adds readRouteEnvironmentId so preview.find, preview.refresh, preview.focusUrl, and zoom shortcuts dispatch on draft routes. The title is specific and related to the main change. It does not cover every detail, such as the toggle exclusion, which is expected.
Full details: Linked Issues check
Explanation
[#35164] The issue requires Ctrl+F/Cmd+F to focus the Files tab Search files box on a draft route, as on a saved thread. The root cause named in the issue is the saved-thread-only gate in previewCommand (apps/web/src/shortcuts/chatRouteCommands.ts). The reviewed head replaces readRouteThreadRef() with a new readRouteEnvironmentId() in the preview handler. It returns the server thread environmentId, or the draft session environmentId from useComposerDraftStore for /draft/$draftId routes. The canOperatePreview check is unchanged, and the handler now calls dispatchPreviewAction for find, refresh, focusUrl, and zoom on drafts. The test file adds draft-route dispatch tests for preview.find, preview.refresh, and preview.focusUrl. The panel-side focus behavior was not read in this review. The issue states that the same key works on drafts through the file tree, so the gate is the only difference. Browser verification is not present; the PR Evidence section is still pending. The code-level requirement is met.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff from merge base d2b8f29 to head 0722a83 changes apps/web/src/shortcuts/chatRouteCommands.ts (gate change and new readRouteEnvironmentId helper, +9/-2) and chatRouteCommands.test.ts (draft-route dispatch tests, +33). Both support the linked issue #35164. The change keeps readPreviewOpen and preview.toggle on the saved-thread gate, as the PR description states. No unrelated file or behavior change was found in the reviewed diff.
Full details: Description check
Explanation
The description follows the template well. It states the problem (on /draft/$draftId, previewCommand shortcuts were claimed and then dropped because readRouteThreadRef() returns null), the change (new readRouteEnvironmentId() that reads the environment from the saved-thread ref or the draft session), and the scope (it fixes #35164, a bug fix). Verification is detailed: a before/after reproduction on main, screenshots and recordings, and unit test results (3 failed / 4 passed without the fix, 7/7 with it). It also lists what was not checked (refresh, focus URL, zoom, macOS Cmd+F, Electron shell) and what is out of scope (preview.toggle, readPreviewOpen). It ends with the AI-assisted note. The template asks for the model and harness used when an agent was involved. The description says 'AI-assisted' but does not name the model or harness, which is a minor gap. The description also says the app was not run in a browser before the fix, yet its Reproduction and Evidence sections describe browser runs. These two statements conflict and should be reconciled. Also, the PR objectives say the Evidence section is still being captured, while the description already includes evidence links.
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
Reviewing files that changed from the base of the PR and between e93f2a5 and 0722a83.
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; 4 remain after this review.
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:trustedAuthor is trusted by repo permissions or 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.
In apps/web/src/shortcuts/chatRouteCommands.ts, previewCommand (preview.find, refresh, focusUrl, zoomIn/zoomOut/resetZoom) dispatched only when readRouteThreadRef() returned a saved-thread ref. On /draft/$draftId that is null, so the shortcut was claimed (preventDefault/stopPropagation) and then dropped. The gate only needs an environment id for the AuthPreviewOperateScope check, so a new readRouteEnvironmentId() returns it from either route kind: the server thread ref, or the draft session's environmentId from the composer draft store. The permission check is unchanged. The panel listeners (FileBrowserPanel find, PreviewView) do not gate on the thread, so once the action is dispatched, Cmd/Ctrl+F focuses Search files on a draft as it does on a saved thread. The bug was reproduced only through the 3 failing tests on factory/repro-35164; the app was not run in a browser before or after the fix. No new regex or parser. Nothing visual changes beyond the shortcuts now working.
Fixes #35164
Reproduction on main
Commit d2b8f29 (origin/main). Ran
T3CODE_DEV_SEED=0 vp run devin a fresh worktree and drove the web client in the preview browser with real key presses (Ctrl as mod on Linux). Draft thread: clicked New thread (route /draft/), opened the right panel (Toggle right panel), pressed F in the surface picker to add a Files tab, focused the + (Add panel surface) button, pressed Ctrl+F. Focus stayed on + ('Add panel surface'); Search files was not focused. Control on a saved-thread route (//) with a Files tab open: focused +, pressed Ctrl+F, and focus moved to 'Search server files'. Note: in the web client, picking Files from the surface picker already focuses its search box, so I moved focus back to + to match the reporter's state. Failing unit tests (preview.find, preview.refresh and preview.focusUrl on a draft route never call dispatchPreviewAction) pushed as factory/repro-35164; they fail 3/7 on main and pass with a minimal gate change, which was reverted.Evidence
Chromium on Linux, 1280×800, light theme; fresh synthetic state on both commits. Open an unsent new thread → toggle right panel → select Files with F → return focus to + by opening and dismissing its menu → press Ctrl+F.
Reproduction scenario
AI-assisted; verified with the tests and tools listed above.
Not shown:
Tests
vp test run src/shortcuts/chatRouteCommands.test.ts (apps/web): 3 failed / 4 passed without the fix, 7/7 passed with it. vp run check:changed: format, lint, knip, typecheck (2 packages), tests (2 files) and react compiler all pass.
Not in this change
AI-assisted; verified with the tests and tools listed above.