Skip to content

Fix Android workspace restore after process recreation#2384

Open
evilcoda wants to merge 1 commit into
getpaseo:mainfrom
evilcoda:fix/android-background-workspace-restore
Open

Fix Android workspace restore after process recreation#2384
evilcoda wants to merge 1 commit into
getpaseo:mainfrom
evilcoda:fix/android-background-workspace-restore

Conversation

@evilcoda

Copy link
Copy Markdown

Fixes #2383.

Problem

After Android reclaims the app process, reopening Paseo can replay the Activity's original pairing intent. OfferLinkListener imports that stale offer again and then unconditionally navigates to the global project setup route, overriding the remembered workspace restored during startup.

Change

Route successful offer imports through the paired host root instead of directly to global project setup. The existing host startup policy then:

  • restores the remembered workspace when one exists for that host;
  • keeps first-time pairing behavior by opening project setup when no workspace is remembered.

The route decision is isolated in a small navigation helper with focused tests, including invalid profile handling.

Reproduction evidence

The bug was reproduced consistently on Android v0.2.0-beta.3 with a v0.2.0-beta.3 workstation. A screen recording shows the app process-recreation splash followed by the unexpected Add project screen.

QA

  • npm --workspace @getpaseo/app test -- src/navigation/offer-link-navigation.test.ts src/navigation/host-runtime-bootstrap.test.ts --bail=1 — 29 tests passed
  • npm run typecheck — passed
  • npm run lint — passed with 0 warnings and 0 errors
  • npm run format:files -- packages/app/src/app/_layout.tsx packages/app/src/navigation/offer-link-navigation.ts packages/app/src/navigation/offer-link-navigation.test.ts — passed

The original bug was reproduced on Android. The patched branch has not yet been installed on a physical Android device; automated coverage verifies the navigation policy and existing workspace restore behavior.

@greptile-apps

greptile-apps Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR changes post-import offer navigation to enter through the paired host root, allowing existing host startup policy to restore a remembered workspace or open project setup for first-time pairing.

  • Adds a focused route resolver that validates the imported profile’s server ID.
  • Updates OfferLinkListener to replace the current route with the paired host root.
  • Adds unit coverage for valid, missing, and non-string server IDs.

Confidence Score: 5/5

The PR appears safe to merge, with the new navigation target correctly delegating remembered-workspace and first-time-pairing behavior to the existing host startup policy.

The successful offer-import path retains server ID validation and now enters the host boundary whose startup policy selects either the remembered workspace or project setup; no concrete changed-code failure remains.

Important Files Changed

Filename Overview
packages/app/src/app/_layout.tsx Routes successful offer imports through the paired host root while preserving cancellation and error handling.
packages/app/src/navigation/offer-link-navigation.ts Introduces a small route resolver that rejects invalid profiles and builds an encoded host-root route.
packages/app/src/navigation/offer-link-navigation.test.ts Covers valid routing and rejection of missing or non-string server IDs.

Sequence Diagram

sequenceDiagram
  participant A as Android / offer link
  participant L as OfferLinkListener
  participant H as Host runtime
  participant R as Expo Router
  participant S as Host startup policy
  A->>L: Deliver pairing URL
  L->>H: Import and upsert offer
  H-->>L: Host profile with serverId
  L->>R: replace(/h/serverId)
  R->>S: Enter paired host root
  alt Remembered workspace exists
    S->>R: Open remembered workspace
  else No remembered workspace
    S->>R: Open project setup
  end
Loading

Reviews (1): Last reviewed commit: "fix(app): restore workspace after Androi..." | Re-trigger Greptile

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.

Android: app reopens project setup after process recreation

1 participant