Skip to content

fix(mobile): swipe back from a session to its host's session list - #36880

Closed
gsxdsm wants to merge 3 commits into
stablyai:mainfrom
gsxdsm:fix/mobile-swipe-back-to-sessions
Closed

gsxdsm wants to merge 3 commits into
stablyai:mainfrom
gsxdsm:fix/mobile-swipe-back-to-sessions

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

ELI5

Swiping back from a chat or terminal on the phone used to throw you all the way out to the server list. Now it takes you one step back, to that server's list of sessions. A second swipe takes you to the server list.

What Changed

There were two causes, and both are fixed.

  • Session opened inside the host page (the common case). The host screen /h/[hostId] is a page document, and tapping a session navigated inside that document. The native stack stayed [server list, host document], so the iOS edge swipe, which belongs to the parent h screen, popped the whole document back to the server list. While the page claims Back (shell path still /h/:id with a session open), the shell now turns the parent gesture off, and a left-edge pan calls bridge.sendBack(). The page then goes back to that host's session list. When the claim drops, the parent gesture returns.
  • Session reached by a replace or a cold open. navigateToHostStackRoute mounted the host list and then a REPLACE removed it, which left [server list, session]. Home's "jump back in", resume and notification taps now PUSH the session, so the host list stays underneath. The native session route also inserts the host list when nothing is underneath (new workspace, agent launch, diff-review replace). Standalone web inserts the route too, so browser back lands on the host list.

Android hardware back follows the same stack. iPhone Duo and iPad still pop to the host index on HostStack.

Why

The first fix only covered native pushes. On a real device the host list is a page-served document, so the session never became its own native screen, and the swipe always belonged to the parent. Routing the edge swipe through the page's own Back claim fixes the real path without changing how pages are hosted.

Linked Issue

Fixes #36879

Visual Proof

Verified on an iPhone Duo (Ad Hoc build of this branch on a fork, paired to a dev host). From a host's session list, open a session, then swipe from the left edge: you land on that host's session list. A second swipe goes to the server list. Before: the first swipe went straight to the server list. A screen recording will follow in a comment.

Testing

  • cd mobile && pnpm typecheck && pnpm typecheck:tests
  • npx vitest run src/mobile-web-shell src/navigation src/session: shell back-claim, host-stack push, session-route repair and the workspace route sweep
  • npx oxlint mobile/src
  • On device (iOS, iPhone Duo): host list → session → swipe back → host list → swipe back → server list.

🤖 Generated with Claude Code

@gsxdsm
gsxdsm force-pushed the fix/mobile-swipe-back-to-sessions branch from ae35536 to 84f266a Compare November 1, 2026 03:38
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cfe5f03c-4d05-48b2-8596-2ed4b92f19c0
Commits

Reviewing files that changed from the base of the PR and between d431eed and 07f5ef3.

Files selected for processing: 1
  • mobile/src/mobile-web-shell/MobileWebShellScreen.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

Session navigation now pushes session routes onto host stacks. Navigation hooks can insert a matching host list beneath a session. Web session routes add conditional host-list repair and Back handling. iOS shell screens add a back-edge gesture and update the parent navigator’s gesture setting while a page claims Back.

Severity of issue fixed: Medium

Merge Risk: Minimal · previous review 07f5e

The navigation changes have no established merge-blocking risk and are mergeable with normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: swiping back from a mobile session now returns to the host's session list.
Description check Passed The description covers the required user impact, implementation changes, rationale, linked issue, visual proof, testing, and AI disclosure. It omits some optional template checklist sections, but the …
Linked Issues check Passed The PR meets the coding requirements in [#36879]. navigateToHostStackRoute pushes session targets and preserves the host list. useSessionHostListBeneath inserts the host list for cold or replace r…
Out of Scope Changes check Passed The production changes support the back-navigation behavior in [#36879]. The added and updated tests verify the required host-stack, web-history, shell-gesture, and entry-route behavior. The reviewed …
Full details: Description check

Explanation

The description covers the required user impact, implementation changes, rationale, linked issue, visual proof, testing, and AI disclosure. It omits some optional template checklist sections, but the core information is complete.

Full details: Linked Issues check

Explanation

The PR meets the coding requirements in [#36879]. navigateToHostStackRoute pushes session targets and preserves the host list. useSessionHostListBeneath inserts the host list for cold or replace routes. useSessionPageBackToHostList handles web history and Back claims. useShellPageBack disables the parent iOS gesture while the page claims Back, and ShellPageBackEdge sends the edge gesture to bridge.sendBack. Android hardware Back remains routed through the session stack. Tests cover navigation repair, web Back, shell gestures, and notification routing.

Full details: Out of Scope Changes check

Explanation

The production changes support the back-navigation behavior in [#36879]. The added and updated tests verify the required host-stack, web-history, shell-gesture, and entry-route behavior. The reviewed change summary and focused source review show no unrelated product behavior.

Full details: Docstring Coverage

Explanation

Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 23 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@gsxdsm
gsxdsm force-pushed the fix/mobile-swipe-back-to-sessions branch 3 times, most recently from 06ac7b6 to d431eed Compare November 1, 2026 04:57
@gsxdsm
gsxdsm force-pushed the fix/mobile-swipe-back-to-sessions branch 4 times, most recently from 998241e to 04b6dc9 Compare November 2, 2026 03:37
gsxdsm and others added 3 commits November 1, 2026 21:06
…erminal

Opening a session replaced the host list, so swipe and hardware back landed on the server list whenever that list was not already underneath. Push the session onto the list, and insert the list when a replace, deep link, or resume skipped it.

Co-Authored-By: Grok <[email protected]>
The session route reads the host stack through useNavigation. That sweep renders the screen, so its expo-router mock has to export the hook.

Co-Authored-By: Grok <[email protected]>
A tap in the page-served host list stays inside that WebView, so the native stack is still the server list under one host screen. That screen's swipe belongs to the parent and pops the whole document. While the page claims Back, disable the parent gesture and turn a left-edge swipe into the page's own back.

Co-Authored-By: Grok <[email protected]>
@gsxdsm
gsxdsm force-pushed the fix/mobile-swipe-back-to-sessions branch from 04b6dc9 to 492729d Compare November 2, 2026 05:11
@AmoabaKelvin

Copy link
Copy Markdown
Collaborator

Thanks @gsxdsm, this was fixed in #36956, which just merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mobile: back from a session skips the host's session list and lands on the server list

2 participants