You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Background root.render() never settles on Lynx for Web — main's validator rejects every cross-realm message #461
On Lynx for Web the background thread never sends a single commit. root.render(App) returns a promise that never settles, transport.acceptedIdentity() stays null, no diagnostics are reported, and every native event is deferred by resolveNativeEventBatch (if (accepted === null) return null) until it expires. Nothing a user does can update the UI.
Root cause (verified — corrects the original triage)
The two Lynx threads are separate JS realms in production (on Web the background runs in its own iframe/worker). Every message main receives is a plain object carrying the background realm'sObject.prototype, never identical to main's. Octane's protocol validator (record() in packages/lynx/src/core/protocol.ts) tested Object.getPrototypeOf(value) === Object.prototype — a realm-local identity check — so main rejected every message the background sent, starting with main-ready-request:
Octane Lynx transport outbound message: must be a plain object.
The handshake therefore never completes and the background never commits.
Correction: an earlier trace logged the raw LYNX_BACKGROUND_TO_MAIN_EVENT listener and concluded "main receives main-ready-request and never replies", pointing at canAnnounceReady() gating / the announceReady() drain. Instrumenting the validator and report() shows the message is rejected beforehandleReady/announceReady ever run — main throws "must be a plain object" on receipt. The gating hypothesis and the "drain queuedReadyRequests on every correlated request" fix are refuted; the handshake code is correct.
This is why the whole suite stayed green: the jsdom tests run both threads in one realm, so the identity check always passed there.
Fix
A shared hasCrossRealmPlainPrototype predicate (accept a null prototype or one that is itself one hop from null — the shape of every realm's Object.prototype; descriptor walks still enforce enumerable/non-accessor/symbol-free data), applied across the protocol, host-driver, host-props, lifecycle-data, worklet, and main-thread validators. Regression: a node:vm test builds envelopes in a real second realm and proves the validators accept them.
Impact / relationship to the other reports
This is the single root cause shared with the blank engine-mode first screen (that symptom is downstream: handleReady never ran, so releaseFirstScreenRender() never fired — see the companion issue). Fixed in #459.
Activity