Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/mobile
Steps to reproduce
- Pair the T3 Code mobile app (Android) with a remote T3 Code server over Tailscale (T3 Connect disabled).
- Turn Tailscale off on the phone (and optionally force-close T3 Code).
- On the remote server (or another client), create a new thread so the mobile app does not have it in its local cache yet.
- From another app (e.g. Telegram), tap the link to that new thread:
https://app.t3.codes/threads/<environmentId>/<threadId>. - Switch to Tailscale, turn VPN on, and return to T3 Code.
(Note: repeating the same steps for an already-cached thread works as expected — the cached thread opens immediately while showing a connecting state. The failure only happens for a new/uncached thread.)
Expected behavior
T3 Code should keep the target (environmentId, threadId) route alive while waiting for the environment to become reachable, instead of replacing it with an empty draft:
- While connecting, show a clear loading/connecting state for that environment (e.g. "Opening thread on
<environment>…" with a Cancel action). - If the environment is unreachable /
offline/error(e.g. Tailscale is off), explain that the app cannot reach that environment yet — rather than discarding the route or showing a generic "not available in the current mobile snapshot" message — and provide Retry + a shortcut to Connections (similar to web PR fix(web): a thread link to an unconnected environment shows why instead of a blank pane #42048). - When the user turns Tailscale on and returns to T3 Code (
AppState→active) or the environment transitions toconnected, automatically retry and open the linked thread without requiring the user to go back and tap the link again. - Only show "Thread unavailable" if the environment is
connectedand the server confirms the thread does not exist or was deleted.
Actual behavior
For an uncached thread (selectedThread === null), once the local cache finishes reading (localCacheRead === true) while the environment is available, offline, or error:
threadRouteIsHydrating(apps/mobile/src/features/threads/thread-route-hydration.ts) returnsfalse.threadRouteOpensDraftreturnstruefor any connection state other thanconnecting/reconnecting.ThreadRouteScreenimmediately mountsUnavailableThreadDraftRedirect, which dispatchesStackActions.replace("Thread", { draft }).
The target (environmentId, threadId) is permanently dropped from the navigation stack. Turning Tailscale on afterwards and returning to T3 Code leaves the user on a new-thread draft and never opens the linked thread.
Related PRs:
- Open PR fix(mobile): a linked thread waits for its environment instead of opening a draft #40607 (
fix(mobile): a linked thread waits for its environment instead of opening a draft) fixes the immediate redirect-to-draft race foravailable/offline/reconnectingwith a 20 s grace window and a manualRetrybutton, and notes there is no existing issue tracking this. - For the Tailscale / VPN-off workflow on a brand-new thread, two gaps remain even with fix(mobile): a linked thread waits for its environment instead of opening a draft #40607:
- If the environment is already in
errorwhen the link is tapped, fix(mobile): a linked thread waits for its environment instead of opening a draft #40607 does not wait. - When the user switches out to enable Tailscale (often >20 s) and returns to T3 Code, there is no clear "Waiting for
<environment>connection" state and no automatic retry / auto-open once the environment connects.
- If the environment is already in
- Related (web-only): merged PR fix(web): a thread link to an unconnected environment shows why instead of a blank pane #42048 addressed unconnected-environment thread links in
apps/webwithout changingapps/mobile.
Impact
Major degradation or frequent failure
Version or commit
T3 Code Mobile 2.3.0, T3 Code server 0.1.11, checked against main @ 28e9072095
Environment
Android 16, T3 Code Mobile 2.3.0, remote Linux server ([email protected]) accessed over Tailscale (T3 Connect disabled); App Link tapped from Telegram
Logs or stack traces
No crash or stack trace. Root cause observed in:
- apps/mobile/src/features/threads/thread-route-hydration.ts (`threadRouteIsHydrating`, `threadRouteOpensDraft`)
- apps/mobile/src/features/threads/ThreadRouteScreen.tsx (`UnavailableThreadDraftRedirect`, `ThreadUnavailableScreen`)
Workaround
Turn Tailscale on first, open T3 Code until the environment connects and syncs, then switch back to Telegram and tap the link a second time.
Activity
test(mobile): a linked uncached thread keeps its route while its envi…