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 keeps the terminal shortcut from switching to the default session when the terminal route carries a query string. It is a small, localized routing fix with a regression test, and no merge-blocking risk remains. The author did not check it on a device.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix and the affected shortcut: Command+Shift+T keeps the selected terminal session. The changeset adds activeThreadSubroute and uses it in HardwareKeyboardCommandProvider so a term…
Description check
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section has substantive content. The Problem section gives reproduction steps, expec…
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 fix and the affected shortcut: Command+Shift+T keeps the selected terminal session. The changeset adds activeThreadSubroute and uses it in HardwareKeyboardCommandProvider so a terminal opened with a terminalId query stays on the selected session. The title is specific and matches the main change. It uses the conventional commit form with the mobile scope, and the wording is plain.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each section has substantive content. The Problem section gives reproduction steps, expected behavior, and a concrete trace of the bug. The Change section explains the helper and where it is used. The Scope section explains why no issue is linked and says the change is a bug fix. Verification gives a focused test with before and after results, the broader check results, and the item not checked (device testing). The template asks for a conventional commit title; the PR title meets that. The description does not include screenshots, but the change has no UI visuals, so this gap does not matter here.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Fix failing CI checks
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 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.