Repository navigation
fix(mobile): return to Home when Back leaves a bot opened from Home - #48091
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Bots opened from mobile Home (Feed/Bots rows and Home's New bot sheet) were pushed over the paired computer's host list, so Back showed that list instead of Home. useOpenBotHome now takes a `standalone` option and forwards it to the session route, the same mechanism Home's agent rows already use. Only the two Home callers opt in; host-screen openers keep the host list beneath the bot. Co-authored-by: Neil <[email protected]>
fc708ff to
307d6ee
Compare
ELI5
On the phone, if you opened a bot from the Home screen and tapped Back, the app showed that one computer's workspace list instead of Home. You had to tap Back twice. Now one Back takes you straight to Home, the same as agents opened from Home already do.
What Changed
Before: Tap a bot on Home (Feed or Bots tab, or Home's New bot sheet), then tap Back. The app shows the paired computer's host list.
After: Tap Back. The app returns to Home.
Mechanism:
useOpenBotHomeopens the bot's Home Chat throughuseOpenMobileSession, which opens a session on top of its host's list unless the route carries thestandaloneparam. Home's agent rows already passstandalone: truefor this reason. This PR adds a{ standalone }option touseOpenBotHomeand forwards it to the session route (mobileSessionRouteTargetalready drops a false value). Only the two Home callers opt in:MobileHomeScreen.tsx).HomeNewBotSheet.tsx).The host screen's New bot sheet, bot deep links (
BotLinkRouter) and group item openers pass nothing, so a bot opened from a host screen still has the host list beneath it. The comment onSTANDALONE_SESSION_PARAMnow mentions bot rows too.Why
Home lists bots from every paired computer, so Back should return to that list, not to one computer's list. Reusing the existing
standaloneparam makes bot rows behave like Home's agent rows, and it already works through both the host-document open path (isStandaloneSessionHref-> the session replaces the list) and the native fallback (navigateToHostStackRouteREPLACEs the index instead of PUSHing). The alternative, a bot-specific rule in host stack navigation, would also change bots opened from a host screen.Linked Issue
No linked issue.
Visual Proof
N/A. This is a React Native navigation change on the phone app, and no device or simulator capture was made. The behavior was verified through a navigation-level test instead (see Testing).
Testing
Reproduced with a scratch vitest that renders the real
HomeNewBotSheetand feeds the realuseOpenBotHome->useOpenMobileSessiontarget into the realnavigateToHostStackRoute, with the host stack mounted and its list focused. On main the target has nostandaloneparam and the action isPUSH(list stays under the bot). On this branch it emitsstandalone=1and the action isREPLACE. Callers that pass no option add no param.vitest run src/navigation src/bots src/homeinmobile/: 10 files, 27 tests pass.pnpm -C mobile typecheckpasses. oxlint,oxfmt --check, the anti-slop and code-quality oxlint configs, ast-grep, and the changed-code quality gate are clean on the 4 changed files.Not run on a device or simulator.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
No test was added on purpose. The change only forwards an existing route param from the two Home callers. The standalone mobile route suite was removed in 1355cc4 (#45865), so no committed test covers
standalonetoday, and a test here would only assert a mocked hook's arguments.Performance
None, because this only runs when the user taps to open a bot from Home. It adds one route param with no I/O, polling or subprocess work, and the standalone path does equal or less navigation work (REPLACE instead of PUSH; one spliced route instead of two).
Risk
The risky part is Back from a bot opened from Home. If wrong, Back from that bot would land somewhere unexpected. Bots opened from a host screen are unchanged. No saved data, wire protocol or desktop change; older paired desktops keep the old behavior. A plain revert backs it out.
Trade-off: Back from a Home-opened bot no longer passes through the computer's workspace list. To reach that list, open the computer from Home (wide layouts still show it in the sidebar).
Level: Low
Review
Original fix by @danielhopkins in #48091. Squashed onto current main with a small simplification of the hook option; authorship preserved.
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)