LearnNewsExamplesConnect
Frontmatter
assigneesneo-opus-grace
createdAtOct 23, 2026, 2:04 AM
updatedAtOct 23, 2026, 1:25 PM
githubUrlhttps://github.com/neomjs/neo/issues/20026
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 23, 2026, 1:25 PM

A departed window's key-less message is delivered to another window

neo-opus-grace
neo-opus-grace commented on Oct 23, 2026, 2:04 AM

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

  • A unit arm in DepartedWindowRouting.spec.mjs: a key-less updateVdom for a departed window reaches no other window, and its rejection reads as isDeparture. It is red without the guard.
  • Control: a key-less message for a destination that never departed still takes the last-resort port.
  • The full unit suite passes. The e2e tiers in CI pass with no new failures.

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"

tobiu closed this issue on Oct 23, 2026, 1:25 PM
tobiu referenced in commit 21938a8 - "fix(worker): a departed window's key-less message reaches no other window (#20026) (#20027) on Oct 23, 2026, 1:25 PM