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(mobile): Command+Shift+T keeps the selected terminal session - #42387
On iPad, Command+Shift+T on a terminal you picked can switch you to a different terminal. Open term-2 from the thread's terminal menu while term-1 is also running, press Command+Shift+T, and the screen moves to term-1. The same screen also enables the hardware Copy PR link or thread shortcut, which #8994 turned off on the terminal ("terminal focus keeps its existing copy behavior"); on Android, reading the native key handling, that shortcut then takes Ctrl+Shift+C before a focused terminal can send it as an interrupt.
Most ways of opening a terminal pass its terminalId route param: the thread menu, Open new terminal, project scripts and the session switcher. React Navigation serializes it as a query. A script that renders the production provider with React Navigation's serializer, then sends Open Terminal, gives (selected is the terminalId left on the route):
path: /threads/env/thread-17/terminal?terminalId=term-2
main: copyEnabled=true navigations=1 selected=null (the screen then picks term-1)
fix: copyEnabled=false navigations=0 selected="term-2"
HardwareKeyboardCommandProvider checks the raw path: pathname.split("/")[4] is terminal?terminalId=term-2, and /\/terminal(?:\/|$)/ does not match before ?. So the provider thinks it is not on the terminal, navigates there without terminalId, and the screen picks its default running session.
Change
activeThreadSubroute reads the thread's subroute from the path before any ? or #. The copy guard and the Files, Terminal and Review checks use it instead of testing the raw path, so a terminal opened with a session id counts as the terminal.
Scope
This is a small fix for an obvious bug, so it has no issue. In-app navigation opens Review and Files without a query, but a link can carry one, so their checks use the same helper. #42336 stops parseActiveThreadPath reading the query into the thread id; this fixes the subroute checks in the provider, and the two merge cleanly.
Verification
HardwareKeyboardCommandProvider.terminal.test.tsx renders the provider on /threads/env/thread-17/terminal?terminalId=term-2, then checks that the Copy PR link or thread shortcut is not enabled and that Open Terminal does not navigate. Its own file keeps it apart from the provider test in #29679.
main: Tests 1 failed (1) (expected [...] to not include 'copyThreadReference')
fix: Tests 1 passed (1)
vp run check:changed upstream/main passes, and the full @t3tools/mobile suite passes (3771 tests). Not checked on a device.
GPT-6.2 Astra (high, Codex) found the bug. Claude Opus 5.5 and GPT-6.2 Sol (high, Codex) reproduced it independently. Claude Opus 5.5 (Claude Agent in T3 Code) wrote the fix and test.
No actionable comments were generated in the recent review.
Walkthrough
The keyboard command provider now uses activeThreadSubroute to check the active thread subroute. A terminal-route test verifies command availability and that invoking the terminal command does not navigate.
Changes: Thread subroute detection
Layer / File(s)
Summary
Identify and check thread subroutes apps/mobile/src/features/keyboard/hardwareKeyboardCommands.ts, apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.tsx, apps/mobile/src/features/keyboard/HardwareKeyboardCommandProvider.terminal.test.tsx, apps/mobile/vite.config.ts
activeThreadSubroute strips a query string or fragment before returning pathname segment 4. The provider uses the helper for copy-reference availability and to skip navigation to the active files, terminal, or review subroute. The terminal-route test checks command availability and navigation behavior, and the Vite configuration includes the test.
This change makes the keyboard command provider recognize thread subroutes when the path has a query string, so the terminal route no longer enables the copy shortcut or navigates away. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the primary change: Command+Shift+T on a selected terminal keeps that session. It matches the fix that reads the thread subroute before any query string, so the provider recognizes a t…
Description check
The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the reproduction path, expected behavior, and a before/after script…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the primary change: Command+Shift+T on a selected terminal keeps that session. It matches the fix that reads the thread subroute before any query string, so the provider recognizes a terminal route with terminalId and does not navigate away. The title is specific and follows the conventional commit format.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the reproduction path, expected behavior, and a before/after script output. The Change section explains the helper and the affected checks. The Scope section explains why no issue is linked and why the change is a bug fix. The Verification section lists a focused test with main and fix results, a broader check run, and states that device testing was not done. The template's conventional commit title guidance is met. The author also names the model and harness that did the work, as the template requests. The description does not link an issue, but it gives a reason for that choice, which the template allows for small obvious bugs.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
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.
1 participant
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.
Problem
On iPad, Command+Shift+T on a terminal you picked can switch you to a different terminal. Open
term-2from the thread's terminal menu whileterm-1is also running, press Command+Shift+T, and the screen moves toterm-1. The same screen also enables the hardware Copy PR link or thread shortcut, which #8994 turned off on the terminal ("terminal focus keeps its existing copy behavior"); on Android, reading the native key handling, that shortcut then takes Ctrl+Shift+C before a focused terminal can send it as an interrupt.Most ways of opening a terminal pass its
terminalIdroute param: the thread menu, Open new terminal, project scripts and the session switcher. React Navigation serializes it as a query. A script that renders the production provider with React Navigation's serializer, then sends Open Terminal, gives (selectedis theterminalIdleft on the route):HardwareKeyboardCommandProviderchecks the raw path:pathname.split("/")[4]isterminal?terminalId=term-2, and/\/terminal(?:\/|$)/does not match before?. So the provider thinks it is not on the terminal, navigates there withoutterminalId, and the screen picks its default running session.Change
activeThreadSubroutereads the thread's subroute from the path before any?or#. The copy guard and the Files, Terminal and Review checks use it instead of testing the raw path, so a terminal opened with a session id counts as the terminal.Scope
This is a small fix for an obvious bug, so it has no issue. In-app navigation opens Review and Files without a query, but a link can carry one, so their checks use the same helper. #42336 stops
parseActiveThreadPathreading the query into the thread id; this fixes the subroute checks in the provider, and the two merge cleanly.Verification
HardwareKeyboardCommandProvider.terminal.test.tsxrenders the provider on/threads/env/thread-17/terminal?terminalId=term-2, then checks that the Copy PR link or thread shortcut is not enabled and that Open Terminal does not navigate. Its own file keeps it apart from the provider test in #29679.vp run check:changed upstream/mainpasses, and the full@t3tools/mobilesuite passes (3771 tests). Not checked on a device.GPT-6.2 Astra (high, Codex) found the bug. Claude Opus 5.5 and GPT-6.2 Sol (high, Codex) reproduced it independently. Claude Opus 5.5 (Claude Agent in T3 Code) wrote the fix and test.