Smart-Add/Kategorie-Vorschlaege auf iPhone/iPad speicherschonend wieder aktivieren #208

Open
opened 2026-09-27 22:19:19 +02:00 by lena · 2 comments
Collaborator

Folgt auf #207: dort wurde das Embedding-Modell auf iOS/iPadOS komplett abgeschaltet (utils/embeddingSupport.ts), weil Safari die Einkaufsliste wegen Speichermangel wiederholt abstuerzen liess. iOS-Nutzer haben damit aktuell keine KI-Vorschlaege beim Hinzufuegen und keine Kategorie-Vorschlaege.

Vorschlag:

  • Nur noch EIN Embedding-Worker pro Seite statt zwei (useSmartAddWorker und useCategorySuggestions teilen sich heute kein Worker-/Modell-Exemplar) - z.B. gemeinsamer Modul-Singleton mit Referenzzaehlung.
  • ONNX-Runtime sparsam konfigurieren (env.backends.onnx.wasm.numThreads = 1, quantisiertes Modell explizit per dtype erzwingen, pruefen welches device transformers.js v4 auf Safari 26 waehlt - WebGPU vs. WASM).
  • Speicherverbrauch in WebKit messen (Playwright-Projekt mit devices['iPhone 15'] / webkit ergaenzen; aktuell laufen e2e nur in Chromium/Firefox) und danach den iOS-Ausschluss in embeddingSupport.ts entfernen oder enger fassen.

Akzeptanzkriterien:

  • Einkaufsliste bleibt auf einem echten iPhone mit Smart-Add aktiv mind. mehrere Minuten stabil (manuell durch einen iOS-Nutzer bestaetigt).
  • e2e-Suite hat ein WebKit/iPhone-Projekt, das mindestens den Einkaufslisten-Grundfluss abdeckt.
Folgt auf #207: dort wurde das Embedding-Modell auf iOS/iPadOS komplett abgeschaltet (utils/embeddingSupport.ts), weil Safari die Einkaufsliste wegen Speichermangel wiederholt abstuerzen liess. iOS-Nutzer haben damit aktuell keine KI-Vorschlaege beim Hinzufuegen und keine Kategorie-Vorschlaege. Vorschlag: - Nur noch EIN Embedding-Worker pro Seite statt zwei (useSmartAddWorker und useCategorySuggestions teilen sich heute kein Worker-/Modell-Exemplar) - z.B. gemeinsamer Modul-Singleton mit Referenzzaehlung. - ONNX-Runtime sparsam konfigurieren (env.backends.onnx.wasm.numThreads = 1, quantisiertes Modell explizit per dtype erzwingen, pruefen welches device transformers.js v4 auf Safari 26 waehlt - WebGPU vs. WASM). - Speicherverbrauch in WebKit messen (Playwright-Projekt mit devices['iPhone 15'] / webkit ergaenzen; aktuell laufen e2e nur in Chromium/Firefox) und danach den iOS-Ausschluss in embeddingSupport.ts entfernen oder enger fassen. Akzeptanzkriterien: - Einkaufsliste bleibt auf einem echten iPhone mit Smart-Add aktiv mind. mehrere Minuten stabil (manuell durch einen iOS-Nutzer bestaetigt). - e2e-Suite hat ein WebKit/iPhone-Projekt, das mindestens den Einkaufslisten-Grundfluss abdeckt.
lena self-assigned this 2026-09-30 14:41:00 +02:00
Author
Collaborator

Claimed by session "Go [bc9bbc]"

Starting work: shared single embedding worker (ref-counted singleton for Smart-Add + category suggestions), lean ONNX config (numThreads=1, explicit quantized dtype, WASM device), and a WebKit/iPhone Playwright project covering the shopping-list basic flow.

Claimed by session "Go [bc9bbc]" Starting work: shared single embedding worker (ref-counted singleton for Smart-Add + category suggestions), lean ONNX config (numThreads=1, explicit quantized dtype, WASM device), and a WebKit/iPhone Playwright project covering the shopping-list basic flow.
Author
Collaborator

Session "Go [bc9bbc]": technical part done and on master (051c1cf7, d051736a, 04512463), CI green incl. the new WebKit leg (run for 9ff77cc4).

Done

  • Only ONE embedding worker per page now: Smart-Add and the category suggestions share a ref-counted worker (embeddingWorkerClient.ts), each with its own corpus inside it (client id); shared category embeddings are computed once. Verified in a real browser: shopping list page runs 1 worker (was 2), model still gets ready in ~5 s.
  • ONNX runtime pinned lean: numThreads = 1, device: 'wasm', dtype: 'q8'.
  • e2e: new project/CI leg Mobile Safari (iPhone 15) (WebKit) with a shopping-list basic flow (create list, add item, check off); same spec also runs on Pixel. WebKit needs a test-only fixture (e2e/mobile/fixtures.ts) because it never sends the Secure session cookie to http://localhost - server cookie policy unchanged.
  • Unit tests for the shared client, opt-in and settings switch; full suite 1590/1590.

Not done - needs a human with an iPhone (AC 1)
The iOS/iPadOS exclusion is still ON by default - removing it without a real-device check risks the #207 crash for every iPhone user. Instead there is a per-device switch: on an iPhone/iPad open Settings > Appearance > "AI suggestions" > "Turn on AI suggestions on this device (experimental)", then open a shopping list, type a few items and leave it open for several minutes.

  • Stable -> remaining work is small: drop the iOS default in utils/embeddingSupport.ts (isEmbeddingModelSupported) and the settings switch, then close this issue.
  • Crashes again -> switch it off in the same place; further ideas: smaller model, or load the model only on first keystroke on iOS.

Label changed to status/blocked (waiting for that manual check), claim released.

Session "Go [bc9bbc]": technical part done and on master (051c1cf7, d051736a, 04512463), CI green incl. the new WebKit leg (run for 9ff77cc4). **Done** - Only ONE embedding worker per page now: Smart-Add and the category suggestions share a ref-counted worker (`embeddingWorkerClient.ts`), each with its own corpus inside it (client id); shared category embeddings are computed once. Verified in a real browser: shopping list page runs 1 worker (was 2), model still gets ready in ~5 s. - ONNX runtime pinned lean: `numThreads = 1`, `device: 'wasm'`, `dtype: 'q8'`. - e2e: new project/CI leg `Mobile Safari (iPhone 15)` (WebKit) with a shopping-list basic flow (create list, add item, check off); same spec also runs on Pixel. WebKit needs a test-only fixture (`e2e/mobile/fixtures.ts`) because it never sends the Secure session cookie to http://localhost - server cookie policy unchanged. - Unit tests for the shared client, opt-in and settings switch; full suite 1590/1590. **Not done - needs a human with an iPhone (AC 1)** The iOS/iPadOS exclusion is still ON by default - removing it without a real-device check risks the #207 crash for every iPhone user. Instead there is a per-device switch: on an iPhone/iPad open Settings > Appearance > "AI suggestions" > "Turn on AI suggestions on this device (experimental)", then open a shopping list, type a few items and leave it open for several minutes. - Stable -> remaining work is small: drop the iOS default in `utils/embeddingSupport.ts` (`isEmbeddingModelSupported`) and the settings switch, then close this issue. - Crashes again -> switch it off in the same place; further ideas: smaller model, or load the model only on first keystroke on iOS. Label changed to status/blocked (waiting for that manual check), claim released.
lena removed their assignment 2026-09-30 16:10:13 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
robert/todo#208
No description provided.