Keep dictation responsive during heavy work #16
Loading…
Reference in a new issue
No description provided.
Delete branch "perf/responsive-ui-workers"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Large recordings could still block the renderer during PCM processing or bulk IPC, while history JSON, logging and native startup work could block Electron main even though inference already used workers.
Move audio segmentation/normalization/WAV encoding to a Web Worker connected directly to the AudioWorklet. WAVs over 1 MiB use acknowledged chunks and a staging worker instead of a whole-buffer main-thread copy. A persistence worker keeps the full history, lossless migrations and atomic saves; main/UI keep only the recent 200-entry cache. File logs run in a worker, and the existing 500-entry log view renders only visible rows.
Native hotkeys and dependency checks run in isolated Electron helper processes. Windows paste key injection runs in a worker; Electron-required clipboard/window/permission operations remain on main. Helper loss cancels/drains active capture before blocking, registration/recovery is coalesced, and quit drains startup and persistence. A worker-thread hotkey experiment crashed on teardown and was rejected.
Observed maximum 5 ms heartbeat gaps on Linux x64 / Electron 45.1.0:
The normalized/staged WAV hashes match exactly; all expected persisted history and unknown metadata remain. These are smoke observations, not universal latency guarantees. DOM/native OS operations still require their owning threads, and OS/driver/native failures can still cause delays. Windows DLL behavior, macOS accessibility permissions and GPU responsiveness were not runtime-tested.
PERFORMANCE.md documents methods, limits and reproduction. The retained responsiveness harness exercises real sandbox preload/IPC/staging/persistence, with only its inference result stubbed; separate real Tiny inference proof covers AudioWorklet -> processing worker -> native Whisper -> live output/history.
Evidence: responsiveness-evidence.tar.gz
Packaged ASAR smoke after native Tiny readiness and capture cancellation:
Proven with 205 passing tests (1,092 assertions), typecheck, oxlint, ESLint, formatting, Knip, production build, a real native capture/import run with responsive controls, full-app helper crash/concurrent recovery/startup-quit checks, UI keyboard/filter/confirmation flows, and Linux unpacked/ASAR worker-path validation. The virtualizer intentionally opts out of React Compiler for its mutable API; oxlint reports the compatibility warning without failing.
The recovery review finding is fixed: recovery waits for new block tasks and refuses to clear a newer failure. A held-probe/typing-state test killed the real helper, verified the failed attempt retained its cause, and confirmed a fresh retry recovered. Regression proof: dependency-race-regression.json
kReview review
Verdict: no findings
No specific defects were verified in the reviewed changes.
This review did not check generated or vendored files:
ui/bun.lock.kReview checked only the PR diff, metadata, and supplied repository context at
a958585d83. It reports only issues supported by this material.Estimated cost: ~$0.60 total (1.1M in / 2.5k out); this run ~$0.29 (467.3k in / 954 out) / gpt-6.1-terra.
Run time: 1:15 total; this run 0:29.