In worker mode, an ordinary API error from the worker is handled as a worker failure, and the bridge moves to the main thread for the rest of the session.
Repro (same on v0.1.44 and v0.1.47, wasm32 and wasm64):
await bridge.tokenize('hi', true); // before loadModelFromUrl
// rejects: "No model loaded. Call loadModelFromUrl first."
await bridge.loadModelFromUrl(modelUrl, { nGpuLayers: 0 });
// window.__llamadartBridgeWorkerFallbackReason === 'No model loaded. Call loadModelFromUrl first.'
// model metadata: llamadart.webgpu.execution === 'main-thread'
Without the early tokenize, execution stays on the worker.
Cause: _tokenizeUnlocked (js/src/llama_webgpu_bridge.js:7392-7406 at 64ba825) calls _disableWorkerFallback(error) for any rejection from _callWorker, without checking what kind of error it is. Other wrappers with the same catch pattern are worth checking.
Expected: fall back only on worker failures (crash, init or transport errors, and the recoverable classes the bridge already recognizes). Rethrow ordinary API errors such as "No model loaded" unchanged, and keep the worker.
Impact: low for llamadart. Its checks found no llamadart call that reaches the bridge before a model loads. Found while validating the bridge pin bump in leehack/llamadart#620.
In worker mode, an ordinary API error from the worker is handled as a worker failure, and the bridge moves to the main thread for the rest of the session.
Repro (same on
v0.1.44andv0.1.47, wasm32 and wasm64):Without the early
tokenize, execution stays on the worker.Cause:
_tokenizeUnlocked(js/src/llama_webgpu_bridge.js:7392-7406at 64ba825) calls_disableWorkerFallback(error)for any rejection from_callWorker, without checking what kind of error it is. Other wrappers with the same catch pattern are worth checking.Expected: fall back only on worker failures (crash, init or transport errors, and the recoverable classes the bridge already recognizes). Rethrow ordinary API errors such as "No model loaded" unchanged, and keep the worker.
Impact: low for llamadart. Its checks found no llamadart call that reaches the bridge before a model loads. Found while validating the bridge pin bump in leehack/llamadart#620.