Context
Found while diagnosing #20017. #19067 settled the invariant "a message for a departed window reaches no sibling", but it holds only for messages that carry a routing key. App#applyDeltas and Component#unmount send {action: 'updateVdom', deltas} to me.windowId with no appName/windowId/port key.
Design authority: src/worker/Base.mjs (sendMessage), "A message addressed to a DEPARTED window stops here, since a sibling's main thread would relay its id as a worker name". This ticket's red is a unit arm against that sentence.
The Problem
Once that window departs, getPort({windowId: dest}) misses. isWindowDeparted(dest) guards only the appName step. With no key in opts, the message reaches the last-resort branch and is posted to me.ports[0], whichever window that is.
Measured on dev b0af996452:
- Unit probe on the
DepartedWindowRouting.spec.mjs stub: removePort(win-old), then a key-less updateVdom to win-old is posted to win-new (departedKnown: true, postedToReloaded: 1).
- e2e probe, a full workstation + dashboard run (
--workers=1): 7 such deliveries. Every one was {"action":"removeNode","id":"neo-dragproxy-N"} for a window that had left (FiveBeat, StackReturnSplit). Those are harmless where they land, so this is a latent defect, not the cause of a known failure (see #20017 for the falsification).
The latent risk: a warm reload or a moved pane renders the same component ids in the receiving window. A misrouted removeNode or style delta for one of those ids applies to the live node.
The Architectural Reality
src/worker/Base.mjs sendMessage (:780-808): the cascade runs direct target → opts.port → opts.windowId → opts.appName (guarded by isWindowDeparted(dest)) → last resort ports[0] (unguarded).
promiseMessage rejects NEO_DEAD_PORT when no port resolves, and isDeparture(reason) falls back to reason.destination. A key-less rejection for a departed window is therefore already settled as a departure (onUnhandledRejection), not mirrored as a worker error.
The Fix
Guard the last resort like the appName step: !me.isWindowDeparted(dest). A departed window's own message then resolves no port and rejects as that window's departure.
Acceptance Criteria
Out of Scope
#20017's hidden panes, which this does not fix (measured). Re-addressing a moved component's deltas to its new window.
Related
#19067 (the invariant), #19056 (departure settlement), #20017 (where this was found).
Sweeps: live latest-open 20 at 2026-10-23T00:03Z, none equivalent. Searched issues for "departed window sibling", "last-resort port", "sendMessage ports[0]": none. Own assignments: #20017 covers the symptom, not this path.
Origin Session ID: d095110a-b243-46a8-87ca-0922d713c375
Retrieval Hint: "departed window key-less updateVdom last resort ports[0] sendMessage"
Context
Found while diagnosing #20017. #19067 settled the invariant "a message for a departed window reaches no sibling", but it holds only for messages that carry a routing key.
App#applyDeltasandComponent#unmountsend{action: 'updateVdom', deltas}tome.windowIdwith noappName/windowId/portkey.Design authority:
src/worker/Base.mjs(sendMessage), "A message addressed to a DEPARTED window stops here, since a sibling's main thread would relay its id as a worker name". This ticket's red is a unit arm against that sentence.The Problem
Once that window departs,
getPort({windowId: dest})misses.isWindowDeparted(dest)guards only theappNamestep. With no key inopts, the message reaches the last-resort branch and is posted tome.ports[0], whichever window that is.Measured on dev
b0af996452:DepartedWindowRouting.spec.mjsstub:removePort(win-old), then a key-lessupdateVdomtowin-oldis posted towin-new(departedKnown: true,postedToReloaded: 1).--workers=1): 7 such deliveries. Every one was{"action":"removeNode","id":"neo-dragproxy-N"}for a window that had left (FiveBeat, StackReturnSplit). Those are harmless where they land, so this is a latent defect, not the cause of a known failure (see #20017 for the falsification).The latent risk: a warm reload or a moved pane renders the same component ids in the receiving window. A misrouted
removeNodeor style delta for one of those ids applies to the live node.The Architectural Reality
src/worker/Base.mjssendMessage(:780-808): the cascade runs direct target →opts.port→opts.windowId→opts.appName(guarded byisWindowDeparted(dest)) → last resortports[0](unguarded).promiseMessagerejectsNEO_DEAD_PORTwhen no port resolves, andisDeparture(reason)falls back toreason.destination. A key-less rejection for a departed window is therefore already settled as a departure (onUnhandledRejection), not mirrored as a worker error.The Fix
Guard the last resort like the
appNamestep:!me.isWindowDeparted(dest). A departed window's own message then resolves no port and rejects as that window's departure.Acceptance Criteria
DepartedWindowRouting.spec.mjs: a key-lessupdateVdomfor a departed window reaches no other window, and its rejection reads asisDeparture. It is red without the guard.Out of Scope
#20017's hidden panes, which this does not fix (measured). Re-addressing a moved component's deltas to its new window.
Related
#19067 (the invariant), #19056 (departure settlement), #20017 (where this was found).
Sweeps: live latest-open 20 at 2026-10-23T00:03Z, none equivalent. Searched issues for "departed window sibling", "last-resort port", "sendMessage ports[0]": none. Own assignments: #20017 covers the symptom, not this path.
Origin Session ID: d095110a-b243-46a8-87ca-0922d713c375 Retrieval Hint: "departed window key-less updateVdom last resort ports[0] sendMessage"