Skip to content

fix(mobile): open the Resume workspace through a mounted host stack - #12001

Merged
Jinwoo-H merged 4 commits into
stablyai:mainfrom
kaynansc:kaynansc/fix-mobile-resume-session
Aug 4, 2026
Merged

Jinwoo-H merged 4 commits into
stablyai:mainfrom
kaynansc:kaynansc/fix-mobile-resume-session

Conversation

@kaynansc

@kaynansc kaynansc commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Tapping Resume on Home landed on a blank host screen instead of opening the workspace session. Resume now uses the same mount-then-replace transition Home already uses for the host editor (#11635) and Tasks (#11853).

Root cause

A cold push straight into the nested /h/[hostId] navigator resolves to the host index route without the dynamic id — the same failure #11853 documented for Tasks. app/h/_layout.tsx then mounts HostProtocolGate with hostId: undefined, so useHostClient(undefined) never connects and the detail stack renders an empty host screen.

#11876 addressed this by swapping the manual href for a typed dynamic href, but that did not change the resolved route. expo-router's resolveHref → encodeParam already applies encodeURIComponent to dynamic segments, so { pathname: '/h/[hostId]/session/[worktreeId]', params } resolves to the same URL the manual string produced (/h/<host>/session/<encoded workspace id>; the workspace id was already passed through encodeURIComponent). The direct cross-stack push — the actual cause — stayed in place.

Change

  • extract the mount-then-replace mechanism out of mobile-task-navigation into src/navigation/host-stack-navigation: mount /h/[hostId], wait for that stack to commit, then REPLACE its index route with the concrete target.
  • Tasks keeps its public API and behavior, now as a thin wrapper over the shared mechanism, so the two Home entry points cannot drift apart again.
  • Resume opens [hostId]/session/[worktreeId] through the same transition via useOpenMobileSession.
  • host and workspace identities stay raw in the REPLACE payload — the navigator owns encoding, so an id containing /, ::, or # reaches the session screen unescaped.

Screenshots

Home Resume before and after the fix

Tapping Resume on a cold app start, on an iOS simulator paired to a headless desktop runtime. Before, the tap lands on a host screen with no host id and a disconnected dot; after, it opens the workspace session with the host connected. The "before" capture was taken by restoring mobile/app/index.tsx and mobile/src/session/mobile-session-route.ts to their b04c695 state and letting fast refresh apply it, so it is the real prior behavior rather than a mock-up.

No styling change — the Resume card and the session screen are unchanged; only the transition between them is.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — 4,042 files and 42,934 tests passed. 5 failures in 2 files are pre-existing on this machine and unrelated: src/relay/agent-exec-handler.test.ts asserts on the spawned codex environment and picks up local shell variables, and config/scripts/check-root-directory-entries.test.mjs runs a shell guard against a throwaway git fixture that exits 2 here. Both fail identically at the b04c695 merge-base, and the whole diff is confined to mobile/.
  • pnpm build — not run locally; the change is confined to mobile/, which is a separate pnpm workspace and is not part of the desktop bundle.
  • pnpm --dir mobile test — 383 files, 2,862 passed and 3 skipped
  • pnpm --dir mobile typecheck, pnpm --dir mobile lint, pnpm --dir mobile format:check
  • pnpm run check:max-lines-ratchet
  • pnpm run check:code-quality:changed — 0 new findings across the changed files
  • Added or updated high-quality tests that would catch regressions

Regression coverage in mobile/src/session/mobile-session-route.test.ts:

  • the session target keeps /, ::, and # raw in its params, and omits name when the workspace has none
  • driving navigateToHostStackRoute with the session target pushes /h/[hostId] first, dispatches nothing until the host stack commits, and only then replaces it with [hostId]/session/[worktreeId]
  • a source guard asserts the Resume card goes through openMobileSession and no longer calls router.push directly — the shape that regressed

The existing mobile-task-navigation suite still passes unchanged against the extracted mechanism, which is the intended proof that Tasks behavior is untouched.

End-to-end on an iOS simulator paired to a headless desktop runtime (node mobile/scripts/start-emulator.mjs): reproduced the blank host screen on the b04c695 implementation, then applied the fix through fast refresh and confirmed the same tap opens the workspace session — the two captures above. Android was not exercised; the code path is platform-neutral React Navigation state, with no platform branches.

AI Review Report

Reviewed with Claude Code. Risks checked and outcomes:

  • Cross-platform (macOS / Linux / Windows): the change is React Navigation state handling inside the Expo app — no platform branches, no keyboard shortcuts or accelerators, no shortcut labels, no filesystem paths, no shell invocation, no Electron main/renderer code. It behaves identically on iOS and Android, and the desktop app is untouched.
  • SSH / remote / local: navigation only; the session screen resolves its host client exactly as before, so LAN, Tailscale, relay, and SSH-backed hosts all follow the same path. No assumption that the workspace is local.
  • Worktrees and folder workspaces: the workspace id is forwarded verbatim, so git worktrees, folder workspaces (folder: ids), and the floating-workspace sentinel keep the branching that already exists in the session screen.
  • Agents and git providers: nothing agent- or provider-specific is touched.
  • Performance: the state listener is armed for one transition and disposed on the first match, when navigation leaves the host stack, if push throws, or when the Home screen unmounts — the same lifecycle the Tasks flow already shipped. No polling, no work added to a hot path.
  • UI quality: no styling, layout, token, or copy change; docs/STYLEGUIDE.md is not engaged.
  • Behavior on failure: if the host stack never commits, the user is left on the host screen with its workspace list — the same graceful degradation as Tasks, and strictly better than the blank screen this replaces.

Flagged and resolved during review: the extraction had to keep mobile-task-navigation's exported surface intact so the Tasks tests remain a real check rather than a rewritten one; the wrapper now re-exports its types and delegates, and its suite passes untouched.

Security Audit

  • Input handling: host and workspace ids come from the host's own catalog over the existing authenticated RPC channel — no new external input, no parsing of untrusted strings.
  • Command execution / path handling: none. Ids are navigation params only; nothing is resolved against the filesystem or passed to a shell.
  • Auth / secrets / IPC: unchanged. No credential, token, keychain, or pairing code is touched, and no new IPC surface is introduced.
  • Encoding: ids are handed to the navigator raw and encoded once by it, removing the double-encoding hazard of hand-built route strings. Nothing is interpolated into HTML, a URL opened externally, or a log line.
  • Dependencies: none added or changed.

No follow-up needed.

Notes

  • iOS and Android only; no desktop impact.
  • Follow-up worth considering (out of scope here): navigateToMobileHostEdit still uses the older requestAnimationFrame variant of this transition rather than waiting for the host stack to commit. It could move onto host-stack-navigation too, but that is a separate behavior change and belongs in its own PR.

X handle: @KaynanSampaio1

@coderabbitai

coderabbitai Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Review 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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 869e8808-5cb7-4e74-bf1a-4af21664b43f

📥 Commits

Reviewing files that changed from the base of the PR and between 76ac490c4eac32713b1c926d3ea0e3fdb5cdb0a6 and cd97b2b.

📒 Files selected for processing (9)
  • mobile/app/index.tsx
  • mobile/src/navigation/host-stack-navigation.test.ts
  • mobile/src/navigation/host-stack-navigation.ts
  • mobile/src/navigation/use-open-host-stack-route.ts
  • mobile/src/session/mobile-session-route.test.ts
  • mobile/src/session/mobile-session-route.ts
  • mobile/src/session/use-open-mobile-session.ts
  • mobile/src/tasks/mobile-task-navigation.ts
  • mobile/src/tasks/use-open-mobile-tasks.ts
🚧 Files skipped from review as they are similar to previous changes (9)
  • mobile/src/session/mobile-session-route.ts
  • mobile/src/session/use-open-mobile-session.ts
  • mobile/src/navigation/use-open-host-stack-route.ts
  • mobile/app/index.tsx
  • mobile/src/tasks/use-open-mobile-tasks.ts
  • mobile/src/navigation/host-stack-navigation.test.ts
  • mobile/src/tasks/mobile-task-navigation.ts
  • mobile/src/session/mobile-session-route.test.ts
  • mobile/src/navigation/host-stack-navigation.ts

📝 Walkthrough

Walkthrough

The change adds shared host-stack navigation that mounts a host route before replacing its nested route. New hooks open host-stack targets for mobile sessions and tasks. Mobile session route construction now uses direct route parameters with an optional workspace name. The home screen resume flow uses the session hook. Tests cover route targets, host mounting, nested replacement, optional names, and hook-based resume navigation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: fixing Resume navigation by mounting the host stack before opening the workspace.
Description check ✅ Passed The description covers the required summary, screenshots, testing, AI review, security audit, and notes with relevant implementation details.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
mobile/src/session/mobile-session-route.test.ts (1)

12-30: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider covering the cancellation path.

navigationHarness returns a vi.fn() unsubscribe from addListener, but no test asserts that cancel() calls it or that a canceled controller skips dispatch. dispose and retarget are the new state-machine behaviors in navigateToHostStackRoute, and coordinateHostStackNavigation depends on isActive(). Adding two assertions on the existing harness would lock that behavior in.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f1b0761-10eb-49f9-9851-4270ca3655de

📥 Commits

Reviewing files that changed from the base of the PR and between b04c695 and 1bd184a4e06932def1256c4658368df51659499d.

📒 Files selected for processing (8)
  • mobile/app/index.tsx
  • mobile/src/navigation/host-stack-navigation.ts
  • mobile/src/navigation/use-open-host-stack-route.ts
  • mobile/src/session/mobile-session-route.test.ts
  • mobile/src/session/mobile-session-route.ts
  • mobile/src/session/use-open-mobile-session.ts
  • mobile/src/tasks/mobile-task-navigation.ts
  • mobile/src/tasks/use-open-mobile-tasks.ts

@greptile-apps

greptile-apps Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes a blank screen when tapping Resume on the Home screen by applying the same mount-then-replace navigation strategy already used for Tasks and the host editor. The root cause was a cold router.push into a nested Expo Router stack, which resolves to the host index route without the dynamic hostId param, leaving HostProtocolGate with undefined.

  • Extracts the mount-then-replace mechanism into a new src/navigation/host-stack-navigation.ts module (and use-open-host-stack-route.ts hook), replacing the Tasks-only copy with a shared, tested implementation.
  • useOpenMobileTasks and useOpenMobileSession are refactored to thin wrappers over useOpenHostStackRoute, sharing a module-level pendingNavigation singleton so concurrent taps across the two buttons coordinate through the same controller.
  • Regression tests cover the full session-route param contract and the mount-before-replace ordering, and the existing Tasks test suite passes unchanged against the extracted mechanism.

Confidence Score: 5/5

Safe to merge — the change is confined to mobile navigation state handling, fixes a real blank-screen regression, and is fully covered by new and existing tests.

The extraction is a straightforward refactor of a well-understood pattern already proven by the Tasks flow. The new shared mechanism adds encoded-param matching, an idempotent cancel guard, and a retarget path tested end-to-end. No auth, data, or platform-specific code is touched. All public APIs are preserved, typecheck and the full test suite pass, and the fix was verified on a live iOS simulator.

Files Needing Attention: No files require special attention. The module-level singleton in use-open-host-stack-route.ts is intentional and well-commented.

Important Files Changed

Filename Overview
mobile/src/navigation/host-stack-navigation.ts New core module: mount-then-replace navigation mechanism extracted from Tasks and generalized for any host stack route. Logic is clean and well-guarded (idempotent dispose, encoded-param matching, hostRouteSeen safety exit).
mobile/src/navigation/use-open-host-stack-route.ts New hook exposing the shared navigation mechanism. Uses a module-level singleton (intentionally documented) to coordinate Resume and Tasks taps; cleanup is idempotent and fires on HomeScreen unmount.
mobile/src/tasks/mobile-task-navigation.ts Refactored to re-export types from host-stack-navigation and delegate to shared helpers. Public API shape is preserved; selectProvider is replaced by retarget internally with no external callers (typecheck confirms).
mobile/src/session/use-open-mobile-session.ts New thin hook wiring mobileSessionRouteTarget into useOpenHostStackRoute. Clean and correct.
mobile/src/session/mobile-session-route.ts createMobileSessionHref replaced by mobileSessionRouteTarget; pathname swapped for name, encoding delegated to the navigator. Falsy name omission is intentional per prior review thread.
mobile/app/index.tsx Resume card onPress now calls openMobileSession instead of router.push(createMobileSessionHref(...)). Minimal and correct; source-guard test pins the new call shape.
mobile/src/navigation/host-stack-navigation.test.ts New test suite covering commit detection, encoded-param matching, cancellation, and retarget coordination.
mobile/src/session/mobile-session-route.test.ts Updated to test mobileSessionRouteTarget, mount-before-replace ordering, and source guard asserting openMobileSession is called (not router.push).

Sequence Diagram

sequenceDiagram
    participant Home as HomeScreen
    participant Hook as useOpenHostStackRoute
    participant Nav as host-stack-navigation
    participant Router as expo-router
    participant RN as React Navigation

    Home->>Hook: "openMobileSession({ hostId, worktreeId, name })"
    Hook->>Nav: coordinateHostStackNavigation(pending, navigation, router, hostId, target)
    Nav->>Router: router.push("/h/encodedHostId")
    Nav->>RN: navigation.addListener("state", onState)
    Note over RN: Host stack mounts (index route)
    RN-->>Nav: onState() fires
    Nav->>Nav: mountedHostStack() checks [hostId]/index committed
    Nav->>RN: "navigation.dispatch({ type: REPLACE, payload: sessionTarget })"
    RN-->>Home: Session screen rendered with hostId + worktreeId
Loading

Reviews (4): Last reviewed commit: "test(mobile): model listener removal in ..." | Re-trigger Greptile

Comment on lines +6 to +13
const openHostStackRoute = useOpenHostStackRoute()

return useCallback(
(params) => {
openHostStackRoute(params.hostId, mobileSessionRouteTarget(params))
},
[openHostStackRoute]
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Independent pending refs don't cross-cancel between Session and Tasks

useOpenMobileSession and useOpenMobileTasks each instantiate their own useOpenHostStackRoute, so each gets a separate pendingRef. If both are called in rapid succession from HomeScreen — e.g., the user taps Tasks and then taps Resume before the first mount settles — two independent navigateToHostStackRoute invocations run concurrently, each pushing /h/[hostId] and listening for state commits. This is not a regression from the previous state (Resume previously fired router.push with no cleanup at all), but now that both paths share the same mechanism, a single shared useOpenHostStackRoute instance in HomeScreen (passed down or lifted) would let them coordinate the same way coordinateHostStackNavigation coordinates repeated taps on the same button.

@kaynansc

kaynansc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Thanks both — pushed 339a0b7 addressing the review:

  • Host param normalization (CodeRabbit, major): hostStackHostRoute() pushes an encoded segment while mountedHostStack() compared the raw id, so an id containing /, #, or % could never match its own push and the REPLACE would never fire — the user would just sit on the host screen. Now the committed param matches in either form, with a guarded decodeURIComponent so a lone % is treated as a non-match rather than throwing. Covered by two cases in the new host-stack-navigation.test.ts. This was inherited from the Tasks flow, so the fix lands there too.
  • Shared pending transition (Greptile, P2): agreed — there is one root navigator, so there should be one pending transition. The pending handle moved from a per-hook ref to module scope in use-open-host-stack-route.ts, so a Tasks tap followed by a Resume tap now cancels through coordinateHostStackNavigation instead of arming two independent pushes.
  • Marker assertions before slicing (CodeRabbit, minor): applied — a renamed banner comment now fails on the marker, not on a misleading missing-call assertion.
  • Empty-string name (Greptile, P2): replied inline — dropping an empty label is intentional, not an accident of the falsy check.

pnpm --dir mobile test (384 files, 2,864 passed / 3 skipped), typecheck, lint, format:check and check:code-quality:changed are green on the updated branch.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
mobile/src/navigation/host-stack-navigation.test.ts (1)

51-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that replacement waits for the host mount.

The test only checks dispatch after setState. An implementation that dispatches before the h route mounts, then dispatches again after mounting, would pass. Assert zero dispatches before setState, then assert one REPLACE action with the host-stack target.

Proposed test update
     navigateToHostStackRoute(harness.navigation, { push }, 'host/one', TARGET)
     expect(push).toHaveBeenCalledWith(hostStackHostRoute('host/one'))
+    expect(harness.navigation.dispatch).not.toHaveBeenCalled()
 
     harness.setState(committedHostState(encodeURIComponent('host/one')))
 
-    expect(harness.navigation.dispatch).toHaveBeenCalledWith(
-      expect.objectContaining({ source: 'host-index', payload: TARGET })
+    expect(harness.navigation.dispatch).toHaveBeenCalledTimes(1)
+    expect(harness.navigation.dispatch).toHaveBeenCalledWith(
+      expect.objectContaining({
+        type: 'REPLACE',
+        target: '/h',
+        source: 'host-index',
+        payload: TARGET
+      })
     )

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 07d21215-f5af-4a5f-b923-1477d4c1534c

📥 Commits

Reviewing files that changed from the base of the PR and between 1bd184a4e06932def1256c4658368df51659499d and 339a0b7101f09d37a5df65b1a98ebf7792fe0244.

📒 Files selected for processing (4)
  • mobile/src/navigation/host-stack-navigation.test.ts
  • mobile/src/navigation/host-stack-navigation.ts
  • mobile/src/navigation/use-open-host-stack-route.ts
  • mobile/src/session/mobile-session-route.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • mobile/src/navigation/use-open-host-stack-route.ts
  • mobile/src/session/mobile-session-route.test.ts
  • mobile/src/navigation/host-stack-navigation.ts

@kaynansc

kaynansc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Both nitpicks applied in 0514d5117:

  • Assert the replace waits for the mount — the encoded-host test now asserts zero dispatches before setState and exactly one REPLACE with the full action shape, so a dispatch-then-redispatch implementation no longer passes.
  • Cancellation path covered — two tests on the existing harness: cancel() unsubscribes, flips isActive() to false and swallows a later host mount; and coordinateHostStackNavigation retargets a still-pending transition to the same host in place (same controller, one push, the second target dispatched) rather than arming a second one.

Mobile suite green: 384 files, 2,866 passed / 3 skipped. Typecheck, lint, format and the changed-code quality gate clean.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
mobile/src/navigation/host-stack-navigation.test.ts (1)

15-34: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Model listener removal in navigationHarness.

unsubscribe is a no-op, and setState invokes the listener after cancellation. The assertions at Line 93 and Lines 96-97 therefore verify only the active guard. They do not verify listener removal. A single callback slot can also hide duplicate registrations.

Store active listeners in a Set, remove each listener from the returned unsubscribe function, and notify only active listeners.

Proposed test-harness fix
 function navigationHarness(initialState: HostStackNavigationState) {
-  let stateListener = () => {}
+  const stateListeners = new Set<() => void>()
   let state = initialState
   const unsubscribe = vi.fn()
   const navigation = {
     addListener: vi.fn((_event: 'state', listener: () => void) => {
-      stateListener = listener
-      return unsubscribe
+      stateListeners.add(listener)
+      return () => {
+        unsubscribe()
+        stateListeners.delete(listener)
+      }
     }),
     dispatch: vi.fn(),
     getState: () => state
@@
     setState(nextState: HostStackNavigationState) {
       state = nextState
-      stateListener()
+      for (const listener of stateListeners) {
+        listener()
+      }
     }
   }
 }

Also applies to: 82-98


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 23071bd8-5cdd-4e78-acc4-745d00f23f68

📥 Commits

Reviewing files that changed from the base of the PR and between 339a0b7101f09d37a5df65b1a98ebf7792fe0244 and 0514d511705874e875691b32179a304b2537d754.

📒 Files selected for processing (1)
  • mobile/src/navigation/host-stack-navigation.test.ts

@kaynansc

kaynansc commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Good catch — applied in 76ac490c4. The harness now keeps listeners in a Set and the returned unsubscribe actually removes the one it registered, in both test files so they can't drift.

Verified it has teeth: dropping the unsubscribeState() call from dispose fails the suite (1 failed / 3 passed) — before this change that mutation passed, since the active guard alone kept dispatch quiet. The cancel test also asserts the listener count goes 1 → 0, and the retarget test asserts it stays at 1 (no second listener armed for the same host).

Mobile suite green: 384 files, 2,866 passed / 3 skipped. Typecheck, lint, format and the changed-code quality gate clean.

@ArtOfIntel

Copy link
Copy Markdown

can't wait for this merge !

Tapping Resume on Home landed on a blank host screen instead of the
session. A cold push straight into the nested /h/[hostId] navigator
resolves to the host index route without the dynamic id, so
HostProtocolGate mounts with hostId undefined and never connects.

Home already worked around this for the host editor (stablyai#11635) and Tasks
(stablyai#11853) by mounting /h/[hostId] first and replacing it once the stack
is committed. Extract that mechanism into host-stack-navigation so
Resume uses the same transition instead of a direct push.

The previous Resume fix (stablyai#11876) swapped the manual href for a typed
dynamic href, but expo-router's encodeParam already applies
encodeURIComponent to dynamic segments, so it resolved to the same URL
the manual string produced and left the cold-navigator path unchanged.

Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B
- match a host route committed as the encoded segment it was pushed as,
  so an id containing `/`, `#`, or `%` still triggers the REPLACE
- share one pending transition across the Home entry points; per-hook
  refs let a Tasks tap and a Resume tap arm two pushes that could not
  cancel each other
- assert the source markers before slicing in the Resume wiring test

Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B
Assert the replace waits for the host mount (zero dispatches before it,
exactly one after), and cover cancel/retarget — the paths the shared
pending transition relies on.
A no-op unsubscribe let setState keep calling a canceled listener, so the
teardown assertions only exercised the active guard. Dropping the
unsubscribe call from dispose now fails the suite.
@Jinwoo-H
Jinwoo-H force-pushed the kaynansc/fix-mobile-resume-session branch from 76ac490 to cd97b2b Compare August 4, 2026 11:56
@Jinwoo-H
Jinwoo-H merged commit 7948e46 into stablyai:main Aug 4, 2026
43 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 4, 2026
Home Resume/Tasks/Accounts and notification taps went back to a plain
router.push into the nested host navigator. On the native build a cold push
there resolves to the host index without the dynamic id, so HostProtocolGate
mounts with hostId undefined and the host screen renders blank (the bug #12001
fixed by mounting /h/[hostId] first and replacing once its stack commits).

navigateFromMobileHome now maps a MobileWebNavigationIntentTarget onto the
matching HostStackRouteTarget and hands the deep ones (session, tasks,
accounts) to coordinateHostStackNavigation via useOpenHostStackRoute. Host-index
intents (newWorkspace, workspaceList) and the whole hybrid build keep their
plain push, and the hybrid navigation intent is still published either way.

The Resume card also regains the `name` param it lost, so the session header
has a title before the workspace loads.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#12001)

* fix(mobile): open the Resume workspace through a mounted host stack

Tapping Resume on Home landed on a blank host screen instead of the
session. A cold push straight into the nested /h/[hostId] navigator
resolves to the host index route without the dynamic id, so
HostProtocolGate mounts with hostId undefined and never connects.

Home already worked around this for the host editor (stablyai#11635) and Tasks
(stablyai#11853) by mounting /h/[hostId] first and replacing it once the stack
is committed. Extract that mechanism into host-stack-navigation so
Resume uses the same transition instead of a direct push.

The previous Resume fix (stablyai#11876) swapped the manual href for a typed
dynamic href, but expo-router's encodeParam already applies
encodeURIComponent to dynamic segments, so it resolved to the same URL
the manual string produced and left the cold-navigator path unchanged.

Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B

* fix(mobile): harden the host-stack transition after bot review

- match a host route committed as the encoded segment it was pushed as,
  so an id containing `/`, `#`, or `%` still triggers the REPLACE
- share one pending transition across the Home entry points; per-hook
  refs let a Tasks tap and a Resume tap arm two pushes that could not
  cancel each other
- assert the source markers before slicing in the Resume wiring test

Claude-Session: https://claude.ai/code/session_01RMoaxp7MLg2ydP28KFLX7B

* test(mobile): lock the host-stack transition state machine

Assert the replace waits for the host mount (zero dispatches before it,
exactly one after), and cover cancel/retarget — the paths the shared
pending transition relies on.

* test(mobile): model listener removal in the navigation harness

A no-op unsubscribe let setState keep calling a canceled listener, so the
teardown assertions only exercised the active guard. Dropping the
unsubscribe call from dispose now fails the suite.

---------

Co-authored-by: kaynan <[email protected]>
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.

6 participants