Skip to content

Commit c6a93e6

Browse files
committed
ticket sync
1 parent c45b566 commit c6a93e6

File tree

4 files changed

+142
-8
lines changed

4 files changed

+142
-8
lines changed

.github/.sync-metadata.json

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"lastSync": "2025-12-19T16:34:04.746Z",
3-
"releasesLastFetched": "2025-12-19T16:34:04.753Z",
2+
"lastSync": "2025-12-19T22:16:48.068Z",
3+
"releasesLastFetched": "2025-12-19T22:16:48.081Z",
44
"pushFailures": [],
55
"issues": {
66
"3789": {
@@ -13087,11 +13087,25 @@
1308713087
"contentHash": "879b3eeea28a80febf47e16c68b2efce765fd3884b2c8b59caf57f6d58505526"
1308813088
},
1308913089
"8146": {
13090-
"state": "OPEN",
13090+
"state": "CLOSED",
1309113091
"path": "/Users/Shared/github/neomjs/neo/.github/ISSUE/issue-8146.md",
13092-
"closedAt": null,
13093-
"updatedAt": "2025-12-19T16:34:00Z",
13094-
"contentHash": "5163c8e7e7b18eac590acd74af753c40e44e49200ac3dc9d6008748cee6bb438"
13092+
"closedAt": "2025-12-19T16:49:24Z",
13093+
"updatedAt": "2025-12-19T16:49:24Z",
13094+
"contentHash": "e876e5913f06becb9c15bb79ffe1723af12954c15fd4e42040aa2b1da754a182"
13095+
},
13096+
"8147": {
13097+
"state": "CLOSED",
13098+
"path": "/Users/Shared/github/neomjs/neo/.github/ISSUE/issue-8147.md",
13099+
"closedAt": "2025-12-19T21:27:41Z",
13100+
"updatedAt": "2025-12-19T21:27:41Z",
13101+
"contentHash": "5158fa900aa393db28f299cf8659111bde276075964f2ec563bad48be4862db1"
13102+
},
13103+
"8148": {
13104+
"state": "CLOSED",
13105+
"path": "/Users/Shared/github/neomjs/neo/.github/ISSUE/issue-8148.md",
13106+
"closedAt": "2025-12-19T22:11:50Z",
13107+
"updatedAt": "2025-12-19T22:11:50Z",
13108+
"contentHash": "100e88745642c2013d5b4468bb8e3c3303dc1b3c49d0192960a46b6d59bc0a4f"
1309513109
}
1309613110
},
1309713111
"releases": {

.github/ISSUE/issue-8146.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
id: 8146
33
title: Enable ResizeObserver for Canvas and Blackboard auto-resize
4-
state: OPEN
4+
state: CLOSED
55
labels:
66
- enhancement
77
- ai
88
- core
99
assignees:
1010
- tobiu
1111
createdAt: '2025-12-19T16:33:18Z'
12-
updatedAt: '2025-12-19T16:34:00Z'
12+
updatedAt: '2025-12-19T16:49:24Z'
1313
githubUrl: 'https://github.com/neomjs/neo/issues/8146'
1414
author: tobiu
1515
commentsCount: 0
@@ -19,6 +19,7 @@ subIssuesCompleted: 0
1919
subIssuesTotal: 0
2020
blockedBy: []
2121
blocking: []
22+
closedAt: '2025-12-19T16:49:24Z'
2223
---
2324
# Enable ResizeObserver for Canvas and Blackboard auto-resize
2425

@@ -37,4 +38,7 @@ Implementation plan:
3738
- 2025-12-19 @tobiu added the `ai` label
3839
- 2025-12-19 @tobiu added the `core` label
3940
- 2025-12-19 @tobiu assigned to @tobiu
41+
- 2025-12-19 @tobiu referenced in commit `8582a71` - "Enable ResizeObserver for Canvas and Blackboard auto-resize #8146"
42+
- 2025-12-19 @tobiu referenced in commit `49eb04a` - "#8146 AgentOS.view.Blackboard: removed the monitorSize config (true is now the default value)"
43+
- 2025-12-19 @tobiu closed this issue
4044

.github/ISSUE/issue-8147.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
id: 8147
3+
title: 'Enhancement: Async Remote Method Registration and Robust Worker Checking'
4+
state: CLOSED
5+
labels:
6+
- enhancement
7+
- ai
8+
- core
9+
assignees:
10+
- tobiu
11+
createdAt: '2025-12-19T21:07:00Z'
12+
updatedAt: '2025-12-19T21:27:41Z'
13+
githubUrl: 'https://github.com/neomjs/neo/issues/8147'
14+
author: tobiu
15+
commentsCount: 0
16+
parentIssue: null
17+
subIssues: []
18+
subIssuesCompleted: 0
19+
subIssuesTotal: 0
20+
blockedBy: []
21+
blocking: []
22+
closedAt: '2025-12-19T21:27:41Z'
23+
---
24+
# Enhancement: Async Remote Method Registration and Robust Worker Checking
25+
26+
This PR introduces a robust, asynchronous mechanism for registering remote methods across workers, replacing the previous "fire-and-forget" approach with a deterministic promise-based flow. It also includes critical fixes for main thread synchronization and addon registration.
27+
28+
**Key Changes:**
29+
30+
1. **Async Remote Registration (`core.Base`):**
31+
* Renamed `sendRemotes` to `promiseRemotes`.
32+
* `promiseRemotes` now returns a `Promise` that resolves only when the target worker acknowledges the registration.
33+
* `initRemote` and `initAsync` are now fully async and await this process.
34+
* Added `remotesReady()` method and `#remotesReadyPromise` to allow external callers (like `Neo.Main`) to await full initialization.
35+
36+
2. **Robust Worker Checking (`hasWorker`):**
37+
* Implemented `hasWorker(name)` in `Neo.worker.Base` and `Neo.worker.Manager`.
38+
* This method checks `Neo.config` (e.g., `useCanvasWorker`, `useServiceWorker`) or the active worker list to determine if a target worker actually exists.
39+
* `promiseRemotes` now uses `origin.hasWorker()` to prevent sending messages to non-existent optional workers (like `task` or `canvas`), fixing runtime errors when these are disabled.
40+
41+
3. **Main Thread Synchronization (`Neo.Main` & `Neo.worker.Manager`):**
42+
* **`Neo.Main`:** `onDomContentLoaded` now explicitly awaits `remotesReady()` for all registered addons and the main instance itself. Removed the arbitrary `timeout(20)` race-condition workaround.
43+
* **`Neo.worker.Manager`:** Updated `onWorkerConstructed` to check for `activeWorkers + 1`. The `+ 1` accounts for the main thread itself, ensuring `loadApplication` is only triggered when *all* threads (workers + main) are ready.
44+
45+
4. **Addon Registration Fix (`Neo.Main`):**
46+
* Fixed a race condition in `registerAddon`. If called multiple times (e.g., via remote method access) before completion, it could incorrectly overwrite the singleton instance in the namespace with the class constructor. The fix ensures `Neo.applyToGlobalNs(addon)` is only called when a new instance is actually created.
47+
48+
5. **Service Worker Support:**
49+
* Added `service` worker support to `hasWorker` checks, honoring `Neo.config.useServiceWorker`.
50+
51+
**Goal:**
52+
Eliminate race conditions during application startup and ensure that all remote methods are guaranteed to be registered before the application logic proceeds.
53+
54+
## Activity Log
55+
56+
- 2025-12-19 @tobiu added the `enhancement` label
57+
- 2025-12-19 @tobiu added the `ai` label
58+
- 2025-12-19 @tobiu added the `core` label
59+
- 2025-12-19 @tobiu assigned to @tobiu
60+
- 2025-12-19 @tobiu referenced in commit `252196e` - "Enhancement: Async Remote Method Registration and Robust Worker Checking #8147"
61+
- 2025-12-19 @tobiu closed this issue
62+

.github/ISSUE/issue-8148.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
id: 8148
3+
title: 'Fix: Multi-Window Remote Registration and Message Routing'
4+
state: CLOSED
5+
labels:
6+
- bug
7+
- ai
8+
- core
9+
assignees:
10+
- tobiu
11+
createdAt: '2025-12-19T22:09:48Z'
12+
updatedAt: '2025-12-19T22:11:50Z'
13+
githubUrl: 'https://github.com/neomjs/neo/issues/8148'
14+
author: tobiu
15+
commentsCount: 0
16+
parentIssue: null
17+
subIssues: []
18+
subIssuesCompleted: 0
19+
subIssuesTotal: 0
20+
blockedBy: []
21+
blocking: []
22+
closedAt: '2025-12-19T22:11:50Z'
23+
---
24+
# Fix: Multi-Window Remote Registration and Message Routing
25+
26+
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.
27+
28+
**Key Changes:**
29+
30+
1. **Window ID Propagation (`Neo.worker.Manager`):**
31+
* Updated `sendMessage` to automatically attach the Main Thread's `windowId` to outgoing messages if not already present (`opts.windowId ??= me.windowId`).
32+
* This ensures that `registerRemote` calls (and all other messages) originating from a specific window carry the correct identifier.
33+
* **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).
34+
35+
2. **Message Forwarding Fix (`Neo.worker.Manager`):**
36+
* Updated `onWorkerMessage` to explicitly set `response.destination = data.origin` when forwarding message replies.
37+
* **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').
38+
39+
3. **Robust Worker Checking (`Neo.worker.Base`, `Neo.worker.Manager`):**
40+
* Added `hasWorker(name)` method to `Neo.worker.Base` (checking `Neo.config`) and `Neo.worker.Manager` (checking `getWorker`).
41+
* **Impact:** Allows safe verification of optional workers (like 'canvas', 'task', 'service') before attempting communication, preventing runtime errors when they are disabled.
42+
43+
**Goal:**
44+
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.
45+
46+
## Activity Log
47+
48+
- 2025-12-19 @tobiu added the `bug` label
49+
- 2025-12-19 @tobiu added the `ai` label
50+
- 2025-12-19 @tobiu added the `core` label
51+
- 2025-12-19 @tobiu assigned to @tobiu
52+
- 2025-12-19 @tobiu referenced in commit `c45b566` - "Fix: Multi-Window Remote Registration and Message Routing #8148"
53+
- 2025-12-19 @tobiu closed this issue
54+

0 commit comments

Comments
 (0)