LearnNewsExamplesServices
Frontmatter
id8148
titleFix: Multi-Window Remote Registration and Message Routing
stateClosed
labels
bugaicore
assigneestobiu
createdAtDec 19, 2025, 11:09 PM
updatedAtDec 19, 2025, 11:11 PM
githubUrlhttps://github.com/neomjs/neo/issues/8148
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 19, 2025, 11:11 PM

Fix: Multi-Window Remote Registration and Message Routing

Closed v11.17.0 bugaicore
tobiu
tobiu commented on Dec 19, 2025, 11:09 PM

This PR fixes critical issues with remote method registration and message routing in multi-window applications, specifically addressing hangs and cross-talk errors when launching new windows or detaching components.

Key Changes:

  1. Window ID Propagation (Neo.worker.Manager):

    • Updated sendMessage to automatically attach the Main Thread's windowId to outgoing messages if not already present (opts.windowId ??= me.windowId).
    • This ensures that registerRemote calls (and all other messages) originating from a specific window carry the correct identifier.
    • Impact: Workers (like App) can now correctly identify the source of a request and route the reply back to the specific Main Thread (Window) that sent it, preventing replies from being sent to the wrong window (e.g., the primary window instead of a popup).
  2. Message Forwarding Fix (Neo.worker.Manager):

    • Updated onWorkerMessage to explicitly set response.destination = data.origin when forwarding message replies.
    • Impact: Prevents the Manager from incorrectly attempting to route a reply to 'main' (causing a crash) when it should be forwarding it back to the original sender (e.g., 'app').
  3. Robust Worker Checking (Neo.worker.Base, Neo.worker.Manager):

    • Added hasWorker(name) method to Neo.worker.Base (checking Neo.config) and Neo.worker.Manager (checking getWorker).
    • Impact: Allows safe verification of optional workers (like 'canvas', 'task', 'service') before attempting communication, preventing runtime errors when they are disabled.

Goal: Ensure stable and correct message routing in complex multi-window environments, enabling features like AgentOS component detachment to work without crashing the original window or hanging the new one.

tobiu added the bug label on Dec 19, 2025, 11:09 PM
tobiu added the ai label on Dec 19, 2025, 11:09 PM
tobiu added the core label on Dec 19, 2025, 11:09 PM
tobiu assigned to @tobiu on Dec 19, 2025, 11:10 PM
tobiu referenced in commit c45b566 - "Fix: Multi-Window Remote Registration and Message Routing #8148" on Dec 19, 2025, 11:11 PM
tobiu closed this issue on Dec 19, 2025, 11:11 PM
tobiu cross-referenced by #8149 on Dec 19, 2025, 11:27 PM