Skip to content

[KS] Dev session: edits full-reload, isolated runtimes don't restart after reload, HMR crash #291

Open

Description

@sethwebster

Found while verifying React Native DevTools (#268) against a real spark dev session of the Kitchen Sink (dev build, driver mode, headless: bun scripts/test-devtools.ts on the #268 branch).

Observed

  1. Edits arrive as full reloads, not Fast Refresh. Editing examples/kitchen-sink/screens/devtools/FastRefreshMarker.tsx (a module that exports only a component, so its own refresh boundary) delivered the change by a full reload of every runtime ([ThreadedRuntime] runtime destroyAll, a new execution context), twice for edit + restore. Same with the DevTools screen unmounted.
  2. After any reload, isolated runtime functions never start. After the reload, ThreadedRuntime.run("ks-devtools", workerProbe, ...) from the remounted screen never reaches native (no runtime function queued log), so the worker runtime does not come back.
  3. Crash on HMR after reload. Once, editing a module the worker runtime also loads (screens/devtools/probe.ts) reloaded every runtime and the app then terminated:
W1011 09:36:13.864588 1879814144 UIManager.cpp:57] UIManager::~UIManager() was called (address: 0x782f0fd818).
W1011 09:36:13.865963 3964010368 Scheduler.cpp:142] Scheduler::~Scheduler() was called (address: 0x782e801980).
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: websocketMessage with body: {
    data = "{\"type\":\"update\",\"body\":{\"revisionId\":\"3e58ec24ac6fbe74\",\"isInitialUpdate\":false,\"added\":[],\"modified\":[{\"module\":[823,\"__d(function (global, require, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap)
    id = 1;
    type = text;
}. RCTCallableJSModules is not set. This is probably because you've explicitly synthesized the RCTCallableJSModules in RCTWebSocketModule, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000186a668c0 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001864c460c objc_exception_throw + 88
	2   Foundation                          0x00000001881fe6a8 -[NSMutableDictionary(NSMutableDictionary) initWithContentsOfFile:] + 0

Expected

Edits hot-update without a reload; isolated runtimes restart after a reload; no crash.

Refs #268

Activity

  1. sethwebster commented on Oct 13, 2026

    @sethwebster
    CollaboratorAuthor

    The new dev-loop gate audit (#460, DX-LOOP-02 and DX-LOOP-04) checks this. On an M4 Max, every Fast Refresh edit of FastRefreshMarker.tsx reloaded the shared runtime: a global set before the edit was gone afterwards. The fix of a syntax error reloaded too. Both checks fail until edits arrive as hot updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions