You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): keep loading a session's tabs until the desktop has sent them - #46118
When the desktop is still starting up, it tells the phone "I don't know this workspace's tabs yet, ask again later". The phone read that as "this workspace has no tabs" and showed "No tabs in this session". It also saved that empty list as the last known tabs. Now the phone keeps showing "Loading tabs" until the desktop sends the real list.
Files
Added
Deleted
Net
Test
1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$44
0
$\color{#1a7f37}{\Huge{\mathbf{+}}}$44
Prod
14
$\color{#1a7f37}{\Huge{\mathbf{+}}}$50
$\color{#cf222e}{\Huge{\mathbf{−}}}$17
$\color{#1a7f37}{\Huge{\mathbf{+}}}$33
What Changed
Before:
Until the desktop's window has published its tab inventory (desktop startup, or a phone reconnecting during a desktop restart), the host answers session.tabs.list/subscribe for a workspace it holds no entry for with a placeholder: publicationEpoch: 'none' (or 'none:client-navigation'), tabs: [].
The phone's snapshot gate accepted it like any snapshot. That set tabs loaded, showed "No tabs in this session" with Create Tab, and wrote [] over the saved last-tabs cache, which survives a force-quit.
Paired desktop clients already ignore this placeholder (hostSnapshotAffirmsWorktreeContents). That's why a laptop on the same proxy showed the tabs and the phone didn't.
After:
The phone drops placeholder frames through that same rule. It keeps loading and keeps the last strip until a real answer lands; the 2 s reconciliation poll keeps asking until then.
The rule moved from the renderer to src/shared/remote-runtime/session-graph/ so both clients share it instead of keeping a mobile copy.
Host change: a macOS desktop whose window has closed keeps running but will never publish. It used to answer an empty workspace with "ask later" forever. It now answers an authoritative empty:<epoch> when no window is attached, so Create Tab is still offered there. Workspaces with saved tabs are hydrated before this answer, as before.
Mixed versions: the phone waits on placeholders only from hosts that advertise the new session-tabs.placeholder-settles.v1 capability. With older desktops it keeps today's behaviour, so an older windowless desktop never leaves the phone spinning.
Why
The host's contract already says a 'none' frame means "ask later, never evidence tabs closed" (runtime-session-contracts.ts). The phone was the only client breaking that contract, so the fix belongs in the phone's snapshot gate, using the shared rule.
The host change is needed so the contract stays true in the one case where nothing would ever follow the placeholder: a windowless desktop. Without it, the phone would spin forever there.
The alternative was a phone-side timeout that turns "ask later" into "empty" after N tries. That brings back the false "No tabs" on a slow host and needs a tuned number; the capability handles mixed versions exactly.
Linked Issue
Refs #44840. This is a partial fix: the phone no longer shows or saves an empty tab list from the desktop's "ask later" answer, which covers the restart and reconnect cases. The reporter says a force-quit still showed no tabs, and that isn't reproduced on current main; the issue stays open for their details on a current desktop build.
Visual Proof
N/A. No new UI. The phone now shows the existing "Loading tabs" state, instead of the existing "No tabs in this session" state, during the window before the desktop publishes. It's a timing change of under a second on a desktop restart (measured below), with no layout, wording or control changes.
Testing
Reproduced on main with a hidden e2e desktop build and a paired client speaking the real phone protocol (pairMobileClient), polling session.tabs.list every 15 to 40 ms:
desktop quit and relaunch: the host answered none:client-navigation with tabs=0 19 times (about 0.5 to 0.9 s) before the real renderer:… list with 2 tabs. The subscription got snapshot none/0 tabs, then updated with 2 tabs.
window closed (macOS keeps running): an empty workspace answered none:client-navigation forever. On this branch it answers empty:1, and a phone terminal.create there still works (headless:pty-backed with 1 tab).
controls with no empty list on main: renderer reload, a phone-side tab close, a new worktree, and a worktree deleted and recreated at the same path.
Addedsrc/main/runtime/session-tabs/publication/windowless-empty-session-tabs.test.ts. It fails without the host change (expected 'none' not to be 'none').
No phone test added:applySessionTabs has no test harness, and a hook test would pin internal setters rather than behaviour. The gate is one call to the shared rule. The host frame sequences above are the real evidence.
pnpm check:changed passes. Platforms: macOS (desktop e2e build). The host change applies to any desktop platform; the windowless state is reachable on macOS only, since other platforms quit when their last window closes.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
Riskiest part: the phone now waits instead of showing "No tabs" on any 'none' answer from a capable host.
Known edge: if the desktop renderer crashes and stays attached without recovering, an empty workspace on the phone shows "Loading tabs", then the existing "Tabs are taking longer than expected" state with Retry, instead of Create Tab. Tab creation can't work while the graph is unavailable anyway.
Performance:
While a host owes an answer, the phone keeps its existing 2 s session.tabs.list poll per open session screen. Before, it stopped after accepting the placeholder.
On a desktop restart that is at most one extra request (the placeholder lasted about 0.5 to 0.9 s).
Phone gate cost: one string compare per frame, and the capability is read through a ref, so it never rebuilds the tab stream.
Host cost: one null check per answer for a workspace with no entry.
Older phones and desktops:
Older phones ignore the new capability.
Older desktops don't advertise it, so new phones behave as before with them.
Older phones paired with a new windowless desktop now get empty:<n> where they got 'none'. Both render as "No tabs", which is correct there.
Back out: a plain revert.
Level: Low
AI Disclosure
Review
Two review rounds (Codex and Claude).
Round 1: both found the same P1, fixed in this PR: a new phone with an older desktop whose window is closed would spin forever on an empty workspace. That's why the capability gate exists.
Round 2: clean. Two P3s were left:
Polling continues while a crashed renderer stays attached; noted above.
A placeholder that lands before the host's capabilities load on first connect still flashes "No tabs" once. The host's follow-up frame settles it.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Security: no change.
Cross-platform: the host change only triggers when no window is attached, which only macOS keeps running.
SSH/remote: serve and orcad publish a headless graph before RPC starts, so they never hit the new branch. Relayed routes need the paired desktop to forward the capability (useRouteCapability) and otherwise keep today's behaviour.
Mobile: covered above.
Backwards compatibility: covered by the capability gate.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
I stated the risk: what could break, for whom, and how to back it out
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
…ished them
A desktop that hasn't published its tab inventory yet (startup, reconnect
during a restart) answers session.tabs with an empty "ask later" frame
(publicationEpoch 'none'). The phone treated it as a final empty list:
it showed "No tabs in this session" and saved [] over its tab cache.
Paired desktops already ignore these frames.
The phone now drops them through the same shared rule, so it keeps
loading and keeps the last strip until the real list arrives.
A desktop whose window has closed will never publish, so the host now
answers a workspace it has no tabs for with an authoritative empty
instead of "ask later". That keeps Create Tab reachable there.
…tle them
An older desktop whose window has closed keeps answering 'none' and never
publishes, so the phone keeps treating its placeholder as empty there. The
host now advertises session-tabs.placeholder-settles.v1.
The changes add a runtime capability for hosts that settle placeholders, and use it to gate mobile session snapshot acceptance. They also update publication epoch selection for a missing snapshot when no authoritative window exists, with a test for an empty tab result. Renderer consumers now import host snapshot authority helpers from the shared session-graph module. Mobile draft pruning now uses confirmsMirroredTabSelection.
Merge Risk: Low · up to 199e2
The change stops the phone from showing "No tabs in this session" during desktop restarts and keeps its saved tab strip. One narrow edge remains. A tab update from a very old desktop that omits the publication epoch could be rejected by the renderer, leaving that workspace's tabs stale. This is unlikely for current hosts and is worth tightening before or soon after merge.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the mobile fix: the phone keeps loading a session's tabs until the desktop sends them. This matches the main change, which makes the snapshot gate ignore placeholder 'ask later' frames…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description follows the repository template closely. It has ELI5, What Changed (before/after and host change), Why (with alternatives considered), a partial Linked Issue (Refs #44840, with explana…
Full details: Title check
Explanation
The title names the mobile fix: the phone keeps loading a session's tabs until the desktop sends them. This matches the main change, which makes the snapshot gate ignore placeholder 'ask later' frames (publicationEpoch 'none') instead of showing 'No tabs'. The title does not mention the host-side windowless change or the new capability, but those are secondary to the primary fix.
Full details: Description check
Explanation
The description follows the repository template closely. It has ELI5, What Changed (before/after and host change), Why (with alternatives considered), a partial Linked Issue (Refs #44840, with explanation that it is a partial fix; the template asks for 'Fixes #' with an actual issue, and the author states the issue stays open), Visual Proof marked N/A with a reason, Testing with the three checkboxes checked and concrete reproduction steps, a Risk section with level, back-out plan and compatibility notes, an Agent skill boundary checkbox, and a Checklist. Gaps: the AI Disclosure section is empty, although the template only asks for it from non-team contributors, and the Review section names the Codex and Claude review rounds, which is informative. The Linked Issue section uses 'Refs' instead of 'Fixes', which the template says is not sufficient for outside contributors; the author's note that the issue remains open explains why, but the repository rule may still need a decision. The final checklist item for lint, typecheck, test and build is unchecked, so those checks are not reported as passing. The description is substantive and mostly complete, so it passes, with these items noted for the author.
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
When the desktop is still starting up, it tells the phone "I don't know this workspace's tabs yet, ask again later". The phone read that as "this workspace has no tabs" and showed "No tabs in this session". It also saved that empty list as the last known tabs. Now the phone keeps showing "Loading tabs" until the desktop sends the real list.
What Changed
session.tabs.list/subscribefor a workspace it holds no entry for with a placeholder:publicationEpoch: 'none'(or'none:client-navigation'),tabs: [].[]over the saved last-tabs cache, which survives a force-quit.hostSnapshotAffirmsWorktreeContents). That's why a laptop on the same proxy showed the tabs and the phone didn't.src/shared/remote-runtime/session-graph/so both clients share it instead of keeping a mobile copy.empty:<epoch>when no window is attached, so Create Tab is still offered there. Workspaces with saved tabs are hydrated before this answer, as before.session-tabs.placeholder-settles.v1capability. With older desktops it keeps today's behaviour, so an older windowless desktop never leaves the phone spinning.Why
The host's contract already says a
'none'frame means "ask later, never evidence tabs closed" (runtime-session-contracts.ts). The phone was the only client breaking that contract, so the fix belongs in the phone's snapshot gate, using the shared rule.The host change is needed so the contract stays true in the one case where nothing would ever follow the placeholder: a windowless desktop. Without it, the phone would spin forever there.
The alternative was a phone-side timeout that turns "ask later" into "empty" after N tries. That brings back the false "No tabs" on a slow host and needs a tuned number; the capability handles mixed versions exactly.
Linked Issue
Refs #44840. This is a partial fix: the phone no longer shows or saves an empty tab list from the desktop's "ask later" answer, which covers the restart and reconnect cases. The reporter says a force-quit still showed no tabs, and that isn't reproduced on current main; the issue stays open for their details on a current desktop build.
Visual Proof
N/A. No new UI. The phone now shows the existing "Loading tabs" state, instead of the existing "No tabs in this session" state, during the window before the desktop publishes. It's a timing change of under a second on a desktop restart (measured below), with no layout, wording or control changes.
Testing
Reproduced on main with a hidden e2e desktop build and a paired client speaking the real phone protocol (
pairMobileClient), pollingsession.tabs.listevery 15 to 40 ms:none:client-navigationwithtabs=019 times (about 0.5 to 0.9 s) before the realrenderer:…list with 2 tabs. The subscription gotsnapshot none/0 tabs, thenupdatedwith 2 tabs.none:client-navigationforever. On this branch it answersempty:1, and a phoneterminal.createthere still works (headless:pty-backedwith 1 tab).Added
src/main/runtime/session-tabs/publication/windowless-empty-session-tabs.test.ts. It fails without the host change (expected 'none' not to be 'none').No phone test added:
applySessionTabshas no test harness, and a hook test would pin internal setters rather than behaviour. The gate is one call to the shared rule. The host frame sequences above are the real evidence.pnpm check:changedpasses. Platforms: macOS (desktop e2e build). The host change applies to any desktop platform; the windowless state is reachable on macOS only, since other platforms quit when their last window closes.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
Risk
'none'answer from a capable host.session.tabs.listpoll per open session screen. Before, it stopped after accepting the placeholder.empty:<n>where they got'none'. Both render as "No tabs", which is correct there.Level: Low
AI Disclosure
Review
Two review rounds (Codex and Claude).
Agent skill upstream boundary
Notes
useRouteCapability) and otherwise keep today's behaviour.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)