Repository navigation
Restore fresh Worker RPC after top-level realm replacement #872
Description
Problem
The exact packaged Code OSS 1.137 acceptance run on AppScene 52c3f302 / WebScene 46011413 passes the first Monaco editor Worker $computeUnicodeHighlights request/reply, the browser extension-host iframe/MessagePort handshake, and MCP secret storage. After the smoke performs a same-origin location.reload() to verify the stored MCP secret, the replacement workbench constructs a new editorWorkerService Worker but never calls its postMessage with the Unicode-highlighter RPC before the 15-second bound expires.
Evidence from artifacts/smoke-52c3f30-4601141-final/native-smoke.json:
- native navigation count: 2;
- second realm:
editorWorkerConstructed=true; - second realm:
editorWorkerRequestandeditorWorkerReplyabsent; - extension iframe, transferred MessagePort, Ready, and Initialized all reached;
- UI timer advanced 1,824 ticks;
- server key mint endpoint was called twice, proving the run crossed the MCP storage/reload boundary;
- the extension host briefly reported unresponsive and then responsive;
- failure:
The unchanged Unicode highlighter did not complete an editor Worker RPC.
The current direct navigation test retires a pre-navigation Worker but only constructs a MessageChannel after navigation. It does not prove that a fresh Worker created by the replacement realm can start, accept a request, publish its reply, and wake the host.
Parent: #81. This is a focused replacement-realm Worker lifecycle slice.
Investigation and implementation
- Extend the native Worker navigation contract to create an RPC Worker before navigation, replace the top-level realm, then create a second RPC Worker and verify an ordered request/reply from the replacement realm.
- Record bounded startup, parent-to-worker enqueue, worker dispatch, worker-to-parent enqueue, host wake, and parent dispatch phases so a failure identifies the missing transition.
- Fix the generic Worker lifecycle/scheduling owner found by the reduced test. Preserve complete retirement of pre-navigation workers and ports.
- Do not add Code OSS-specific behavior or a longer product timeout.
Gates
- replacement-realm Worker request/reply after same-origin reload;
- pre-navigation Worker produces no late callbacks;
- 100 navigation/recreation cycles with bounded native bindings, queues, V8 heap, RSS, descriptors, and wall time;
- structured-clone and transferable MessagePort ordering remain unchanged;
- packaged Code OSS completes Monaco RPC in both realms while UI timer progress continues;
- macOS exact package first, then Linux/Windows installed Runtime lanes under [Epic] Restore full V8 Linux and Windows package portability #687/Publish installed full-V8 Runtime components for Linux and Windows #809.
Acceptance
The unchanged packaged workbench completes its Monaco Worker request/reply before and after one same-origin reload, retains responsive UI scheduling, and introduces no application patch or browser/WebView dependency.
Activity