Repository navigation
fix(windows): Open Settings from Chat without blanking it or hanging the next open - #1217
Conversation
WebView2 deadlocks when a synchronous Chat command builds the Settings webview on the main thread. Post that build from another thread. Co-authored-by: Oded Messer <odedmesser@gmail.com>
The hint and the Chat Settings button are async commands, the same shape as opening Chat. Tray and the menu still present on the shell thread. Co-authored-by: Oded Messer <odedmesser@gmail.com>
4a376c4 to
f48b346
Compare
f48b346 to
4a376c4
Compare
A Chat open that emits before navigation, then a menu open that activates that window, blanks Settings and hangs on WebView2 MoveFocus. Co-authored-by: Oded Messer <odedmesser@gmail.com>
4a376c4 to
6cd34e2
Compare
Windows does not call /usr/share absolute, so the Linux search-path tests drop those directories when the windows job runs them. Co-authored-by: Oded Messer <odedmesser@gmail.com>
|
Fixed Windows CI failures for the three The fix checks if a path starts with Windows CI now green: https://github.com/omesser/fidget/actions/runs/36804100497/job/110184557572 — Signed-off-by: Cursor Agent (Cloud) |
omesser
left a comment
There was a problem hiding this comment.
Soft-re-gate — PR #1217
Verdict: Soft CLEARED — Hard Holds. Soft (f) Open settling → Pass (tip CI fully green). Soft CLEARED = pass (merge-ready pending your yes). Soft Open would mean not pass yet. Do not treat as Approve.
Tip gated: 0a6bd211e6ac980b63ddbd4a74bd728d6aa5c0e0 (cursor/windows-settings-chat-blank-14dc)
vs prior Soft-Pass Soft f settling COMMENT 5374115628 same tip — Soft (f) settled green; no Soft flip elsewhere. Wake was Oded’s issue-comment summarizing the landed XDG Soft-FIX (not a tip move).
Draft: no · Mergeable: yes · mergeStateStatus: CLEAN · Closes #1216: yes · base main @ 0df3b59f · label windows
Hard (value-preservation) — Holds
- Tray / menu / anchor /
FIDGET_OPEN_SETTINGS: stillpresent_settingson the shell thread (MenuAction::OpenSettings, Linux GTKconnect_focus_in_event, WindowsWA_CLICKACTIVE, env hook). Chat webview commands alone areasync. - Chat open still works:
names_hint_act/show_settingsstayasync(WebView2 pump off), same shape asoverlay_open_chat. - No new sync rebuild on the pump:
settings_opened_from_chat_stays_off_the_webview_pumpstill pins Future bounds. - Load hang gate: Show while
!document_ready→ empty effects (no raise / MoveFocus); after load Focus+Raise; Chat reload only when ready;about:skipped; generation match. - XDG Soft-FIX is package-path only:
xdg_baseskeeps leading-/entries as absolute bases on Windows; no Settings pump/load change.
Soft ledger
| Soft | Status | Evidence |
|---|---|---|
| (a) #1216 acceptance | Pass | Chat Open Settings off-pump; no emit into just-built window; menu leave-loading-alone; Closes #1216. |
| (b) Pump / async | Pass | Chat commands async → present_settings; tray/menu/GTK/WA_CLICKACTIVE/env → present_settings on shell thread. |
| (c) Load gating | Pass | Create: Build+Raise. Show while loading: empty. After load: Focus+Raise; Chat reload only when ready. about: skipped; generation match. |
| (d) Tests | Pass | Named filters present (a_menu_open_after_chat_does_not_focus_settings_still_loading, chat_reloads_settings_only_after_the_document_has_loaded, settings_opened_from_chat_stays_off_the_webview_pump); sync regression compile-time. Tip CI green includes Settings Soft tests. |
| (e) Merge hygiene | Pass | 4 coherent commits (3 Settings + 1 XDG Soft-FIX); MERGEABLE CLEAN; files main.rs + package.rs; Closes #1216. |
| (f) CI on tip | Pass | Tip 0a6bd211: PR Tests run 36804100497 — ubuntu / macos / windows SUCCESS; Pages build SUCCESS / deploy SKIPPED. Soft (f) Open settling → Pass. |
| (g) Cross-platform / #1212 | Pass | Linux GTK focus → present_settings intact; shared helpers not Windows-only; XDG leading-/ filter is platform-correct for Linux path strings on Windows runners. |
Soft-FIX
None. Softs a–g Pass; Hard Holds.
Notes
- UX/UI delta: Same user job (Open Settings from Chat / menu / tray). On Windows Chat path: Settings should paint instead of blanking/hanging; menu/tray behavior unchanged (still shell-thread
present_settings). Linux/macOS Settings open paths unchanged by this PR’s Chat-async/load gate; #1212 Linux GTK taskbar focus path remains shell-threadpresent_settings. - Soft CLEARED at tip after Soft (f) green — await Oded merge yes; never merge without that yes.
— Cursor agent (Architect), on @omesser's behalf.
Soft-FIX — Soft (f) CLEAREDTip: Those tests pass Soft (f): — Cursor agent (Coder), on @omesser's behalf. |
omesser
left a comment
There was a problem hiding this comment.
Design note — caveats (not Soft-FIX)
Soft CLEARED still holds. Design judgment on tip 0a6bd211: the dual fix (async Chat entry points off WebView2’s pump + document_ready / generation gating of Focus/Raise/Reload) is the right shape for #1216’s blank + hang race. These are residual caveats to watch, not merge blockers.
1. Create still Raises before ready
settings_effects(Create) is Build + Raise, while Show while !document_ready is deliberately empty (no Focus / Raise — Raise → SetForegroundWindow → wry MoveFocus is the hang path on a loading HWND).
So “don’t MoveFocus until ready” is not uniform: first open still Raises on a newborn controller. That is assumed safe on the create turn (hang attributed to later activation of an already-loading window). If a hang ever shows on first open only, defer Raise into finish_settings_document (trade: Settings may sit under the overlay until load finishes).
2. “Leave loading alone” can strand
While gens don’t match, every open is a pure no-op. Create has already raised a white window; menu/tray clicks do nothing until on_page_load Finished (non-about:). If navigation never finishes, there is no timeout, rebuild, or queued post-ready Focus — user stays stuck until kill.
Optional follow-up (not required for this tip): on finish_settings_document, drain a pending_raise / single deferred Focus; or timeout → destroy + recreate.
Out of scope here
XDG package.rs Soft-FIX is unrelated to this race.
— Cursor agent (Architect), on @omesser's behalf.
|
Addressing Architect’s design note (review): caveats tracked as V1 Todo follow-ups, not Soft-FIX for this tip. Soft CLEARED on
XDG Soft-FIX stays out of scope for this race, as noted. — Cursor agent (Coder), on @omesser's behalf. |
Why
On Windows, Chat’s “Window names are off” → Open Settings opens a blank white Settings window and leaves that one shared window wedged. Opening Settings again from the context menu shows the same white window, then the process stops responding and has to be killed.
names_hint_actwas a synchronous command, so the build ran on WebView2’s pump thread. The same constraint is already load-bearing for opening Chat (overlay_open_chat, #588). That path also emittedsettings-refreshinto the window it had just built, before navigation finished. The context menu then activates the same window.set_focusisMoveFocus.SetForegroundWindowdeliversWM_SETFOCUS, and wry’s parent subclass callsMoveFocusfrom that message too. Tray and the menu are not on the Chat pump, and a page that does load already waits for__TAURI__(#1117 / #1127).What changed
names_hint_actandshow_settingsareasync, so the Settings build is queued off the pump the way Chat’s open is. Tray, the menu, the anchor, andFIDGET_OPEN_SETTINGSstill callpresent_settingson the shell thread.A Chat open that creates the window does not emit into it. The reveal stays in the snapshot, which the page reads when it loads. Until that document finishes (not the
about:blankthe controller starts on), a later open does nothing: no raise, noMoveFocus. Once it has loaded, the menu raises and focuses it, and a Chat open reloads so the aim lands.How to verify
cargo test -p fidget --bin fidget -- a_menu_open_after_chat_does_not_focus_settings_still_loading chat_reloads_settings_only_after_the_document_has_loaded settings_opened_from_chat_stays_off_the_webview_pumpa_menu_open_after_chat_does_not_focus_settings_still_loadingfails if a context-menu open while the document is still loading raises or focuses that window.settings_opened_from_chat_stays_off_the_webview_pumpfails to compile if either Chat entry point is synchronous again.Shell unit tests: 670 passed. Three Linux secret-service tests failed here because no Secret Service is running, and two GTK double-click tests hang without a display. The other workspace crates passed. This environment has no WebView2, so the blank window and the hang were not launched here.
Notes
Closes #1216.
— Cursor agent (Coder), on @omesser's behalf.