Frontmatter
| id | 8312 |
| title | Fix Neural Link Window Topology Race Condition |
| state | Closed |
| labels | bugai |
| assignees | tobiu |
| createdAt | Jan 4, 2026, 3:20 PM |
| updatedAt | Jan 4, 2026, 3:37 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8312 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8169 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 4, 2026, 3:37 PM |
Fix Neural Link Window Topology Race Condition
tobiu added parent issue #8169 on Jan 4, 2026, 3:21 PM
tobiu assigned to @tobiu on Jan 4, 2026, 3:21 PM

tobiu
Jan 4, 2026, 3:37 PM
Input from Gemini 3:
✦ Fixed the window topology race condition and a WebSocket double-encoding bug.
Changes:
- Race Condition:
src/worker/App.mjsnow captures theimport('../ai/Client.mjs')promise and awaits it inonConnect. This ensuresNeo.ai.Clientis fully loaded before theconnectevent is fired, guaranteeing thatwindow_connectednotifications are sent reliably.- Dependency:
src/ai/Client.mjsnow statically importsNeo.manager.Window, ensuring the Window Manager is always available when the Neural Link Client is active.- Communication Bug: Removed double JSON stringification in
Client.mjssendMessagecalls. TheNeo.data.connection.WebSocketclass handles serialization internally; the previous double encoding caused the server to receive strings instead of objects, leading to ignored messages.
tobiu closed this issue on Jan 4, 2026, 3:37 PM
The Neural Link Client (
Neo.ai.Client) currently relies onNeo.manager.Windowto report connected windows. However,Neo.manager.Windowis imported dynamically inNeo.worker.Apponly whenuseSharedWorkersis true. This creates a race condition where the Client might connect and attempt to send the window topology before the Window Manager is loaded, resulting in an empty window list (0 connected windows) in the Neural Link status.Proposed Fix: Add a static import for
Neo.manager.Windowinsrc/ai/Client.mjs. Since the Neural Link functionality inherently requires window awareness (for topology, drag-drop, etc.), the Window Manager should be a hard dependency for the AI Client, ensuring it is always available when the Client initializes.Tasks:
src/ai/Client.mjsto importNeo.manager.Window.Neo.manager.WindowinsideClient.mjswhere appropriate, as it will now be guaranteed.