Skip to content

fix(mobile): mount host before opening tasks - #11853

Merged
brennanb2025 merged 8 commits into
mainfrom
brennanb2025/mobile-tasks-page-fixes
Aug 1, 2026
Merged

brennanb2025 merged 8 commits into
mainfrom
brennanb2025/mobile-tasks-page-fixes

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix Home Tasks and provider shortcuts opening a blank Host screen on a cold nested navigator.
  • Mount the selected host route first, then replace it with a concrete encoded Tasks path on the next animation frame.
  • Preserve the selected task provider in the taskSource query parameter.

Root cause

A cold deep push into the nested host navigator can resolve to its index route without the dynamic host ID. Live iOS simulator testing also showed that a dynamic route object can lose hostId during the second navigation. Mounting the host stack first and then using a concrete path preserves the selected host.

Test plan

  • Reproduced before the correction in an iPhone simulator against a connected Electron-backed LAN host: Home → Tasks opened the blank Host / Filter / Recent / Repo screen.
  • Verified after the correction with a cold app start on the same host: Home → Tasks opened the Tasks screen with GitHub task controls.
  • Mobile test suite: 377 files and 2,816 tests passed, with 3 existing skips.
  • Typecheck passed.
  • Lint passed.
  • Regression coverage verifies concrete host-path encoding, provider selection, and cold navigator sequencing.

Evidence

Blank Host screen reached from Home Tasks

Physical TestFlight verification requires a build containing this change.

@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
📝 Walkthrough

Walkthrough

Added typed mobile task route builders with optional provider support. Added pending navigation intents and mounted-host route resolution. Added MobileTaskHostRoute to redirect pending Tasks navigation and render the host screen or wide-layout placeholder. Updated the mobile entry point to use centralized task navigation. Added tests for route construction, intent handling, navigation errors, host redirection, stale intents, and fallback rendering.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change and testing, but it omits the required AI Review Report, Security Audit, Notes, and template-based Screenshots and Testing sections. Add the missing AI Review Report, Security Audit, and Notes sections, and align Screenshots and Testing with the repository template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary mobile navigation fix.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f5123e8-5d43-432b-bc19-93c23b9f8230

📥 Commits

Reviewing files that changed from the base of the PR and between e79304c and 612111fd4b751c536a2168769aef31853384d752.

📒 Files selected for processing (3)
  • mobile/app/index.tsx
  • mobile/src/tasks/mobile-task-navigation.test.ts
  • mobile/src/tasks/mobile-task-navigation.ts

@greptile-apps

greptile-apps Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR fixes a cold-start navigation bug where opening Tasks from the Home screen would land on a blank Host screen. The root cause was a direct router.push to the nested tasks route before Expo Router had initialized the host stack, causing it to resolve to the index route instead.

  • Replaces the single router.push('/h/{id}/tasks') call with a two-step sequence: push the host route first (/h/{id}), then listen for the navigator state to confirm the host index is mounted, and finally dispatch a REPLACE action to swap to [hostId]/tasks — preserving the encoded host ID and optional taskSource provider.
  • Introduces navigateToMobileTasks / coordinateMobileTasksNavigation in mobile-task-navigation.ts and the useOpenMobileTasks hook to own the coordination lifecycle, including deduplication of redundant host pushes and cleanup on unmount or user back-navigation.
  • Adds six targeted unit tests covering the happy path, provider threading, early-exit disposal, deduplication, and synchronous push errors.

Confidence Score: 5/5

The change is safe to merge. The two-step navigation pattern is correctly implemented with proper cleanup, and the unit tests cover the key edge cases.

The core fix — waiting for the host stack to commit before dispatching the REPLACE action — is sound. The listener is subscribed before the push, disposed before dispatching, and guarded by the active flag throughout.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
mobile/src/tasks/mobile-task-navigation.ts New module implementing the two-step host-then-tasks navigation coordination. State listener, host-stack detection, and cleanup logic are all correctly ordered and guarded.
mobile/src/tasks/use-open-mobile-tasks.ts React hook wrapping coordinateMobileTasksNavigation with a ref for pending state; cleanup effect correctly cancels on unmount, and useCallback deps are stable Expo Router references.
mobile/src/tasks/mobile-task-navigation.test.ts Six well-scoped unit tests covering happy path, provider preservation, cancellation, deduplication, early-navigation-exit cleanup, and synchronous push errors. No test isolation issues in the current revision.
mobile/app/index.tsx HomeScreen now delegates task navigation to useOpenMobileTasks, removing the direct router.push path that bypassed host-stack initialization.

Reviews (8): Last reviewed commit: "fix(mobile): await delayed host stack se..." | Re-trigger Greptile

@brennanb2025
brennanb2025 force-pushed the brennanb2025/mobile-tasks-page-fixes branch from 612111f to 4a7e0d0 Compare August 1, 2026 00:35

@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 (2)
mobile/src/tasks/mobile-task-navigation.test.ts (1)

22-27: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the unsupported provider fallback.

mobileTasksRouteFromHostAction converts an unsupported taskSource into a provider-less Tasks route. Add an assertion for this branch.

Proposed test
     expect(mobileTasksRouteFromHostAction('host-1', 'newWorktree', 'github')).toBeNull()
     expect(mobileTasksRouteFromHostAction(undefined, 'tasks', 'github')).toBeNull()
+    expect(mobileTasksRouteFromHostAction('host/1', 'tasks', 'unsupported')).toBe(
+      '/h/host%2F1/tasks'
+    )
mobile/src/tasks/MobileTaskHostRoute.test.ts (1)

41-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the wide-layout fallback.

The current test only covers isWideLayout: false. Add a test that sets mocks.isWideLayout to true and expects WorkspaceDetailPlaceholder.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 54b1625c-ece4-4d54-8104-210406478176

📥 Commits

Reviewing files that changed from the base of the PR and between 71d0023 and 681916a.

📒 Files selected for processing (5)
  • mobile/app/h/[hostId]/index.tsx
  • mobile/src/tasks/MobileTaskHostRoute.test.ts
  • mobile/src/tasks/MobileTaskHostRoute.tsx
  • mobile/src/tasks/mobile-task-navigation.test.ts
  • mobile/src/tasks/mobile-task-navigation.ts

@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/tasks/MobileTaskHostRoute.test.ts (1)

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

Replace the deprecated renderer in new tests.

React 19.2 deprecates react-test-renderer. Use the repository-supported Testing Library integration for this new route coverage. Confirm the supported native test utility before migration.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cc37d05-f86e-4892-bc50-b91f2ff0ea92

📥 Commits

Reviewing files that changed from the base of the PR and between 681916a and 60caeeb.

📒 Files selected for processing (4)
  • mobile/src/tasks/MobileTaskHostRoute.test.ts
  • mobile/src/tasks/MobileTaskHostRoute.tsx
  • mobile/src/tasks/mobile-task-navigation.test.ts
  • mobile/src/tasks/mobile-task-navigation.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/src/tasks/MobileTaskHostRoute.tsx

@brennanb2025

Copy link
Copy Markdown
Contributor Author

QA evidence for 6797058950123692ed24b158b1855935b14d86a9

  • Electron: paired-host Orca Mobile view validated with $electron.
  • Mobile: QA-devqa-serial on iOS 26.5, clean dev-client install, fresh Metro bundle, and cold starts.
  • Cold-start Tasks card-body action opened the mounted Tasks screen with live GitHub issues.
  • A separate cold start confirmed the GitHub provider shortcut opens the same Tasks screen.

Electron paired-host view

Mobile home

Mobile Tasks

@brennanb2025
brennanb2025 merged commit 4c03cdf into main Aug 1, 2026
43 checks passed
Jinwoo-H pushed a commit to kaynansc/orca that referenced this pull request Aug 4, 2026
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
Jinwoo-H pushed a commit that referenced this pull request Aug 4, 2026
…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 (#11635) and Tasks
(#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 (#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]>
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant