Repository navigation
fix(session-tabs): a returning paired publisher is repaired by an authoritative census - #27094
Conversation
…horitative census, not dropped
…ile it was in flight
…d is forgotten with its worktree
0fadcb0 to
046363b
Compare
📝 Walkthrough
Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change repairs the paired session-tab mirror after a temporary headless publisher, with guards against stale or non-authoritative data. No merge-blocking risk remains; a tab-removal test assertion would be a nice addition. Pre-merge checks |
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/renderer/src/runtime/web-session-tabs-retired-epoch-census-repair.test.tsx (1)
171-200: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a tab-removal assertion after the census repair.
Issue
#21928requires the client to receive both new tabs and tab removals after authoritative confirmation. This test checks only thathost-tab-bappears. Publish one more frame withRENDERER_EPOCH, version 6, and onlyterminal('a'). Then assert thathost-tab-bis gone. This assertion confirms that the revived lineage accepts frames on the normal stream path after the repair.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
83f512d8-04c4-480e-9e35-42a62c89a96d
📒 Files selected for processing (4)
src/renderer/src/runtime/web-session-tabs-retired-epoch-census-repair.test.tsxsrc/renderer/src/runtime/web-session-tabs-sync/global-session-events.tssrc/renderer/src/runtime/web-session-tabs-sync/retired-epoch-census.tssrc/renderer/src/runtime/web-session-tabs-sync/tracking-lifecycle.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
ELI5
A desktop paired to an Orca server could stop showing new tabs in a workspace: after the server briefly wrote that workspace's tab list itself, the desktop treated the normal writer as dead and threw away its updates for good. Now, when the desktop throws away an update for that reason, it asks the server for a full tab census, and if the server says that writer is current, the update lands.
What Changed
Before: the server mints short-lived
headless:publication ids for a workspace whenever it changes tabs itself (navigation, moving a tab, tab props, closing a structured session). The renderer's own id then comes back. The desktop's fence retires the previous id whenever a new one appears, so the returning renderer id was rejected at every gate and nothing ever revived it. Tabs created after that never appeared until the app restarted (#21928).After: a frame dropped because its publication id is retired schedules one bounded census (
session.tabs.listAll) for that environment and workspace, through the shared repair lane from #27093 (at most 3 attempts per 60 s, backoff 250 ms to 5 s, coalesced per workspace). If the census is labelledauthoritativeand names that id, its lineage is revived and the census snapshot for that one workspace goes through the normal stream apply path. A delayed frame from the short-lived writer is then the retired one and stays fenced.Mechanism:
retired-epoch-census.tsowns the paired lane.handleGlobalSessionEventschedules it when the frame it just recorded is retired.loadInitialWebSessionTabs.admitRetiredValueUnderAuthoritywith the lineage matcher, so the subscription fence itself is never relaxed.Why
The local mirror already solved this exact sequence with an authoritative census; the paired path never used it. Asking the host is the only safe way to tell a live returning publisher from a dead one, because a delayed frame from a dead generation can carry a higher version. Alternatives considered: relaxing the fence for higher versions (resurrects dead generations), or a host-assigned total frame order (needs both a new host and a new client, which the upcoming layout stream already covers).
Mixed versions: the host labels a census
authoritativeonly for clients that advertise the authoritative-inventory capability. An older host's unlabeled census may be partial, so it revives nothing and behavior there is unchanged. Takes over the approach of #21932 (@shahidbeig-a11y), with credit.Linked Issue
Fixes #21928
Refs #19092, #21052 (one of their possible causes).
Visual Proof
N/A: background tab-mirror bookkeeping; covered by the renderer test below.
Testing
src/renderer/src/runtime/web-session-tabs-retired-epoch-census-repair.test.tsx(new; the first case fails onorigin/mainwithexpected [ 'web-terminal-host-tab-a' ] to include 'web-terminal-host-tab-b'): renderer R@v3 → headless H@v1 → R@v5 carrying a new tab mirrors the new tab after one authoritative census, and a delayed H@v2 is still rejected. An unlabeled (older host) census revives nothing.web-session-tabs*,host-session-mirror*andlocal-structured-session*suites pass.pnpm tc:web,oxlint,pnpm run check:code-quality:changed.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
Stacked on #27093. Renderer-only; no new RPC method or field. SSH-hosted and folder workspaces are keyed by environment and workspace id like any other. Census load is bounded by the existing repair budget and reuses the same
listAllthe bootstrap already pays for.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)