fix(local-inference/ios): keep the screen awake during model download on the full-Bun engine (#11841) - #11897
Conversation
… on the full-Bun engine (#11841) Squashed reland of three fixes onto develop. iOS auto-lock could suspend the runtime mid-download and stall it; hold the idle timer open while an in-process model download is active, and make it fire on the production full-Bun engine path (not just the JSContext compat bridge). - downloader.ts: drive keep_awake_set around the active download. - KeepAwakeBridge.swift: JSContext-free core with a process-wide `shared` singleton + `setEnabled(_:)` ref-counted idle-timer holder. - KeepAwakeBridge+JSContext.swift: compat-engine installer, split out so the core compiles into the full-Bun build (no JavaScriptCore). - FullBunEngineHost.swift: add a `keep_awake_set` host_call case. - BridgeInstaller.swift: install the keep-awake bridge. - ios/bridge.ts (capacitor): define `keep_awake_set` on the full-Bun path. - podspec: compile KeepAwakeBridge.swift into the full-Bun source set. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
❌ PR title does not match the required pattern. Please use one of these formats:
|
Relands the keep-awake-during-download fix for #11841 onto develop as a single squashed commit (the three source commits self-conflict in
KeepAwakeBridge.swiftwhen applied individually, so they are collapsed here).What / why
On iOS, auto-lock could suspend the runtime mid-download and stall the model transfer (#11841). This holds the iOS idle timer open while an in-process model download is active, and — critically — makes it fire on the production full-Bun engine path, not just the JSContext compatibility bridge (device logs confirmed the sideload build runs
compiledEngine=full-bun, where the host function was previously unregistered and the call a silent no-op).downloader.ts— drivekeep_awake_setaround the active download.KeepAwakeBridge.swift— JSContext-free core with a process-widesharedsingleton + ref-countedsetEnabled(_:)idle-timer holder.KeepAwakeBridge+JSContext.swift(new) — compat-engine installer, split out so the core compiles into the full-Bun build (which omits JavaScriptCore).FullBunEngineHost.swift— add akeep_awake_sethost_callcase.BridgeInstaller.swift— install the keep-awake bridge.plugin-capacitor-bridge/src/ios/bridge.ts— definekeep_awake_seton the full-Bun path (fire-and-forget; failures can't affect the download).KeepAwakeBridge.swiftinto the full-Bun source set.Testing
plugin-local-inferencedownloader.test.ts— 20/20 pass.plugin-capacitor-bridgetypecheck — clean (tsgo --noEmit).ruby -cSyntax OK.feat/multi-account-login-verification) carries the device evidence for iOS on-device model download stalls when the app backgrounds / device locks (no background URLSession for the ~5GB pull) #11841 (download completes with the idle timer held). Re-verify on device before/after merge.🤖 Generated with Claude Code