Skip to content

fix(web): iOS Safari crash — force WASM backend + tiny.en on mobile - #3

Merged
momentmaker merged 1 commit into
mainfrom
fix/ios-webgpu-crash
Jun 17, 2026
Merged

momentmaker merged 1 commit into
mainfrom
fix/ios-webgpu-crash

Conversation

@momentmaker

Copy link
Copy Markdown
Member

Symptom

talk.pilgrimapp.org crashes the tab on iPhone 16e / iOS 26 during model download.

Root cause (systematic debugging)

On-device tests isolated the failing component:

  • ?engine=mock (no model) → works → UI/terminal fine on iOS.
  • ?model=…tiny.en (37 MB) → still crashes → not memory, not model size.

The only difference is the real-engine runtime: the worker selects WebGPU on iOS 26 (navigator.gpu exists), and Safari's WebGPU + ONNX-runtime (jsep) path crashes the tab loading Whisper. (An OOM/GPU tab-kill can't be caught in JS, so the fix is to avoid the path, not catch it.)

Fix

  • iOS forces the WASM backend (skips the WebGPU probe) — the stable cross-browser path.
  • Mobile defaults to tiny.en (lighter + faster on CPU/WASM).
  • Both overridable for on-device bisecting: ?device=wasm|webgpu, ?model=….
  • Desktop unchanged (isIOS/isMobile false → WebGPU probe + base.en).

device threads main resolveEngine → LiveModeSession → TransformersRecognizer → the worker load message.

Verification

tsc clean · 219 vitest · net-silence canary 2/2 · build ok. Needs a real iPhone test after deploy — I can't reproduce iOS Safari from CI.

🤖 Generated with Claude Code

…ny.en on mobile

iPhone 16e / iOS 26 crashes the tab loading the engine — base.en AND tiny.en both
crash, while ?engine=mock works. So it's not memory or the UI: it's the real-engine
runtime. On iOS the worker selects WebGPU (navigator.gpu exists), and Safari's
WebGPU + ONNX-runtime (jsep) path crashes loading Whisper.

Fix: iOS forces the stable WASM backend (skips the WebGPU probe); mobile also
defaults to the lighter/faster tiny.en. Both overridable for on-device bisecting:
?device=wasm|webgpu and ?model=…. Desktop is unchanged (isIOS/isMobile false →
probe WebGPU + base.en as before). device threads main → LiveModeSession →
TransformersRecognizer → worker load message.

UNVERIFIED on iOS from here — needs a real-device test after deploy.
tsc clean; 219 vitest pass; net-silence canary 2/2; build ok.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@momentmaker
momentmaker merged commit 5a1fe2a into main Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant