Context
Captured by @neo-opus-grace as a defect-note (2026-09-16): a remote method that returns a falsy value never settles its main-thread promise, so Neo.worker.App.getConfigs for an unknown id hangs. Promoted on triage: an executable probe confirms it, and finds two more defects in the same lines.
Correction (2026-09-16, from the PR's CI): this body first claimed no caller compensates for the envelope shape. That census grepped remote-proxy calls only. Three e2e specs call Neo.worker.Manager.promiseMessage from the page and read the SharedWorker envelope — see The Architectural Reality and AC-5. Their passing on dev is also the real SharedWorker witness for defect 3.
Probe: the child-process harness of test/playwright/unit/vdom/MainRenderQueue.spec.mjs, driving src/worker/Manager.mjs at dev@e197300297 with onWorkerMessage({action: 'reply', destination, replyId, data}) against a registered promise:
| destination |
payload |
result |
'main' |
undefined, null, false, 0 |
pending forever, promises[replyId] leaked |
'main' |
{ok: 1} |
resolved with the payload |
'main' |
Error, envelope reject: true |
resolved with the Error |
Manager.windowId |
{ok: 2} |
resolved with the whole envelope {action, destination, replyId, data} |
The Problem
The reply branch of Manager#onWorkerMessage settles a promise main holds like this:
if (dest === 'main') {data = data.data}
if (data) {promise[data.reject ? 'reject' : 'resolve'](data); delete me.promises[replyId]}Reassigning data to the payload breaks three things:
- The truthiness gate drops falsy results. Neither
resolve nor delete runs.
reject is read from the payload, not from the envelope RemoteMethodAccess#reject builds ({action: 'reply', data, reject: true, replyId}). A main-thread awaiter never sees a rejection.
- A reply addressed by window id is never unwrapped. Under SharedWorkers,
RemoteMethodAccess#resolve / #reject rewrite a main-origin reply's destination to the window id, and this branch only treats 'main' as main.
The Architectural Reality
worker.Base#onMessage already settles its own replies correctly: reject from the envelope, data.data as the value, whatever its truthiness. Main diverged from that rule.
- The rest of
onWorkerMessage already treats dest === 'main' || dest === me.windowId as addressed to this thread (registerAppName, remoteMethod); only the reply branch does not.
- A promise main holds for a forwarded request (
dest is another worker) settles with the envelope, and the forwarding .catch reads err?.data ?? err. That contract stays.
- Main-thread consumers of these promises (census of
promiseMessage( across src/main, src/Main.mjs, src/worker/Manager.mjs, test/playwright, apps, examples):
- generated remote proxies (
RemoteMethodAccess#generateRemote): main.DomAccess ×2 (App.setConfigs, which returns result objects) and Manager#setGlobalConfig ignore the value;
Manager#checkServiceWorkerVersion reads swVersion?.version, the payload;
- three e2e specs read the SharedWorker envelope:
core/AppWorkerErrorMirror.spec.mjs (receipt.data.success), core/WorkerErrorMirror.spec.mjs (receipt.data.success, receipt.origin), and core/WorkerErrorGate.spec.mjs, which reads both shapes as (receipt?.data ?? receipt) under the comment "A SharedWorker answers with the message envelope, a dedicated worker with its data".
The Fix — src/worker/Manager.mjs
A promise main holds for itself (dest === 'main' || dest === me.windowId) settles like worker.Base settles its own: reject from the envelope, data.data as the value, entry deleted — whatever the payload's truthiness. A forwarded promise keeps settling with the envelope. The three e2e specs read the payload.
Acceptance Criteria
Out of Scope
- Worker-side settlement (
worker.Base#onMessage): already correct.
- Reply routing and port lookup (#12958, #18265): settled elsewhere.
Related
#12958 · #18265 · #8339
Live latest-open sweep: latest 20 open issues at 2026-09-16T09:05:08Z; no equivalent found
A2A claim sweep: latest 30 inbox messages, all read-states, at 2026-09-16T09:05Z; only the defect-note this promotes, no claim
MC sweep: query_raw_memories on the symptom ("main thread remote method call never resolves when worker returns undefined or null; rejected remote call resolves on main; shared worker reply resolves with the message envelope") + KB ticket query, 6 + 6 results; neighbours #8339 / #18265 (reply routing) and #12958 (worker-side reply port), no prior decision on main-side settlement
Own-assignment sweep: 8 open, none on src/worker/Manager.mjs
Origin Session ID: fda7faab-19c5-43a0-b192-003966068172
Retrieval Hint: "worker.Manager onWorkerMessage reply settlement: falsy payload never resolves, envelope reject ignored, windowId-addressed reply resolves with envelope"
Context
Captured by @neo-opus-grace as a defect-note (2026-09-16): a remote method that returns a falsy value never settles its main-thread promise, so
Neo.worker.App.getConfigsfor an unknown id hangs. Promoted on triage: an executable probe confirms it, and finds two more defects in the same lines.Correction (2026-09-16, from the PR's CI): this body first claimed no caller compensates for the envelope shape. That census grepped remote-proxy calls only. Three e2e specs call
Neo.worker.Manager.promiseMessagefrom the page and read the SharedWorker envelope — see The Architectural Reality and AC-5. Their passing ondevis also the real SharedWorker witness for defect 3.Probe: the child-process harness of
test/playwright/unit/vdom/MainRenderQueue.spec.mjs, drivingsrc/worker/Manager.mjsatdev@e197300297withonWorkerMessage({action: 'reply', destination, replyId, data})against a registered promise:'main'undefined,null,false,0promises[replyId]leaked'main'{ok: 1}'main'Error, envelopereject: trueErrorManager.windowId{ok: 2}{action, destination, replyId, data}The Problem
The reply branch of
Manager#onWorkerMessagesettles a promise main holds like this:if (dest === 'main') {data = data.data} if (data) {promise[data.reject ? 'reject' : 'resolve'](data); delete me.promises[replyId]}Reassigning
datato the payload breaks three things:resolvenordeleteruns.rejectis read from the payload, not from the envelopeRemoteMethodAccess#rejectbuilds ({action: 'reply', data, reject: true, replyId}). A main-thread awaiter never sees a rejection.RemoteMethodAccess#resolve/#rejectrewrite a main-origin reply's destination to the window id, and this branch only treats'main'as main.The Architectural Reality
worker.Base#onMessagealready settles its own replies correctly:rejectfrom the envelope,data.dataas the value, whatever its truthiness. Main diverged from that rule.onWorkerMessagealready treatsdest === 'main' || dest === me.windowIdas addressed to this thread (registerAppName,remoteMethod); only the reply branch does not.destis another worker) settles with the envelope, and the forwarding.catchreadserr?.data ?? err. That contract stays.promiseMessage(acrosssrc/main,src/Main.mjs,src/worker/Manager.mjs,test/playwright,apps,examples):RemoteMethodAccess#generateRemote):main.DomAccess×2 (App.setConfigs, which returns result objects) andManager#setGlobalConfigignore the value;Manager#checkServiceWorkerVersionreadsswVersion?.version, the payload;core/AppWorkerErrorMirror.spec.mjs(receipt.data.success),core/WorkerErrorMirror.spec.mjs(receipt.data.success,receipt.origin), andcore/WorkerErrorGate.spec.mjs, which reads both shapes as(receipt?.data ?? receipt)under the comment "A SharedWorker answers with the message envelope, a dedicated worker with its data".The Fix —
src/worker/Manager.mjsA promise main holds for itself (
dest === 'main' || dest === me.windowId) settles likeworker.Basesettles its own:rejectfrom the envelope,data.dataas the value, entry deleted — whatever the payload's truthiness. A forwarded promise keeps settling with the envelope. The three e2e specs read the payload.Acceptance Criteria
'main'whose payload isundefined,null,falseor0resolves with that payload and removes its promise entry (unit).'main'withreject: truerejects with its payload (unit).Manager.windowIdresolves with its payload, not the envelope, and rejects onreject: true(unit).MainRenderQueue.spec.mjsstays green.AppWorkerErrorMirror,WorkerErrorMirrorandWorkerErrorGateread the payloadpromiseMessageresolves with, and pass in CI'se2e-engine.Out of Scope
worker.Base#onMessage): already correct.Related
#12958 · #18265 · #8339
Live latest-open sweep: latest 20 open issues at 2026-09-16T09:05:08Z; no equivalent found A2A claim sweep: latest 30 inbox messages, all read-states, at 2026-09-16T09:05Z; only the defect-note this promotes, no claim MC sweep:
query_raw_memorieson the symptom ("main thread remote method call never resolves when worker returns undefined or null; rejected remote call resolves on main; shared worker reply resolves with the message envelope") + KB ticket query, 6 + 6 results; neighbours #8339 / #18265 (reply routing) and #12958 (worker-side reply port), no prior decision on main-side settlement Own-assignment sweep: 8 open, none onsrc/worker/Manager.mjsOrigin Session ID: fda7faab-19c5-43a0-b192-003966068172 Retrieval Hint: "worker.Manager onWorkerMessage reply settlement: falsy payload never resolves, envelope reject ignored, windowId-addressed reply resolves with envelope"