You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(windows): avoid WebView polling during voice input - #89
Avoid synchronous child-WebView polling that can freeze the Windows desktop wrapper while voice-dictation software injects text into a focused Hermes WebUI input.
Changes
Remove the periodic URL/session capture, cookie polling, and busy-state eval() loop.
Disable synchronous cookie reads used for profile-dot refresh.
Preserve event-driven tab/window behavior.
Testing
This branch was tested with Typeless voice input on Windows. The freeze was reproduced before the change and no longer occurred after the change.
The change is intentionally limited to the Tauri desktop wrapper; it does not modify hermes-webui.
Review at b898e4f40 — right instinct, wrong blast radius (platform-scope this)
Thanks @josephcy95 — the Windows freeze is real and your diagnosis is correct: a synchronous WebView2 cookie/eval read that re-enters the WebView2 UI thread while voice-dictation software is injecting text into a focused input will deadlock the host window. But the current patch fixes a Windows-only WebView2 re-entrancy bug by removing the capability on all three platforms, and Linux (WebKitGTK) and macOS (WKWebView) don't share that deadlock. I reproduced the regressions by reading the code and confirmed them with our senior-advisor gate (Codex). Verdict: changes needed before this can merge.
Regressions this introduces on Linux/macOS (and a CI break)
Profile-dot capture is now dead on every platform, not just Windows — strip.rs:1289. The unconditional let _ = (...); return; sits at the top of capture_tab_profile(), and that function is the single chokepoint for all callers, including the event-driven ones your PR description says still work: the route bridge handler (recapture_tab_profile, fired by SSE-driven/SPA navigation — bridge.rs:689) and on_page_load. So "Profile dots still update on fresh navigation" isn't what the code does — fresh navigation routes straight into the early return. Worse, session restore serializes tab.profile (the cookie-derived value), while the profile bridge event only updates the display-only dot_profile — so with capture disabled, a tab whose profile was switched in-page can reopen under its previous/default profile. This is a data-correctness regression, not just a cosmetic dot.
Stale busy spinner returns (issue Desktop: tab "working" spinner goes stale on inactive tabs — stays spinning after session finished (clears on focus) #74) on Linux/macOS — main.rs. Deleting the 4s timer removes the only native caller of window.__hermesReportBusy. That eval exists precisely because hidden webviews throttle/suspend their own JS timers, so the 700ms BUSY_REPORTER goes quiet in a background tab and the spinner stays stuck after the response finishes. There's no event-driven substitute for this — it's a poll by design.
Session autosave loses the no-structural-event cases — main.rs. session::persist() does still fire on structural events (window move/resize at windows.rs:464, tab open/close/reorder in strip.rs), so Persist and restore open tabs across restart/upgrade (Windows/Linux strip mode) #18 is the least affected. But the timer covered exactly the cases with no structural event — an SPA navigation, a rapid frame change coalesced away by the single-flight guard, structural churn right before quit. Those are now unsaved on all platforms.
CI will fail on this head — the original capture_tab_profile body below the return; is now unreachable, which trips the repo's cargo clippy -- -D warnings policy (unreachable_code). (The PR also currently shows no CI run yet — mergeStateStatus is UNSTABLE with checks pending.)
The minimal correct fix — scope the workaround to Windows
Keep your Windows behavior exactly as you have it, but stop punishing the platforms that don't deadlock. Concretely:
The 4s timer in main.rs: wrap the whole std::thread::spawn(move || loop { … }) block in #[cfg(not(target_os = "windows"))] so Linux/macOS keep session persist + profile sweep + busy re-poll, and Windows gets your no-timer behavior. (The existing menu_open skip inside it already handled the #33 TrackPopupMenu case; that guard stays with the non-Windows build.)
capture_tab_profile in strip.rs: make the early return #[cfg(target_os = "windows")] only — e.g.
fncapture_tab_profile(app:&AppHandle,window_label:&str,tab_label:&str){#[cfg(target_os = "windows")]{// WebView2 synchronous cookie reads can re-enter the UI thread and// deadlock while voice-dictation software injects text. Skip the read// on Windows; the existing menu_open chokepoint guard (#33) covered the// popup case, this covers the AX-injection case.let _ = (app, window_label, tab_label);return;}#[cfg(not(target_os = "windows"))]{// …existing body unchanged…}}
That removes the unreachable_code clippy failure (nothing is unreachable — one arm is cfg'd out), keeps the WebKitGTK/WKWebView cookie read, and preserves profile-restore correctness off Windows.
The remaining Windows question — a design call, please weigh in
With the workaround correctly scoped, Windows still loses session-of-navigation autosave, the busy re-poll, and cookie-based profile capture. If Windows parity matters (I'd argue the profile-restore correctness one does), the right follow-up is a non-synchronous path on Windows — e.g. a debounced persist off cached in-memory state (URL map + strip state you already keep) that never touches wv.cookies()/eval on the UI thread, and driving the busy indicator from the bridge event rather than an eval poll. That's more than a mechanical change, so I'd rather you own the Windows-parity decision than have me guess it.
One thing I can't verify from here: that your scoped Windows change actually clears the Typeless freeze — I don't have a Windows + voice-dictation setup to reproduce it. The #[cfg] scoping above preserves your Windows behavior byte-for-byte, so if it fixed the freeze before, it still does; please just re-confirm on your machine after scoping.
Happy to push the mechanical #[cfg] scoping to your branch if you'd like — say the word. Otherwise, drop the platform-scoped version here and I'll re-gate the new head.
Wrapped the 4s periodic polling timer in src-tauri/src/main.rs with #[cfg(not(target_os = "windows"))] so macOS and Linux keep session autosave, profile-dot refresh, and busy re-poll completely unchanged.
Scoped the early no-op in capture_tab_profile() in src-tauri/src/strip.rs to #[cfg(target_os = "windows")] (with the original body under #[cfg(not(target_os = "windows"))]), removing the unreachable-code clippy failure, and gated recapture_profiles() with #[cfg(not(target_os = "windows"))] to avoid a Windows dead_code warning.
Verified cargo fmt --check passes cleanly.
On the Windows-parity design question: I'd prefer to ship this minimal Windows-scoped workaround first so the WebView2 UI deadlock during voice input is resolved, and leave an async/non-reentrant Windows parity path as a separate follow-up. Since the #[cfg] scoping keeps the Windows behavior identical to the build already tested with Typeless, it preserves the fix as-is.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avoid synchronous child-WebView polling that can freeze the Windows desktop wrapper while voice-dictation software injects text into a focused Hermes WebUI input.
Changes
eval()loop.Testing
This branch was tested with Typeless voice input on Windows. The freeze was reproduced before the change and no longer occurred after the change.
The change is intentionally limited to the Tauri desktop wrapper; it does not modify hermes-webui.