Skip to content

Windows: window_control::toggle_pin blocks the TUI thread on the host terminal's message pump (SetWindowPos/ShowWindow cross-process) #5923

Description

@Hmbown

Found while fixing #5919 (PR #5922). PinCmd::execute calls window_control::toggle_pin() (crates/tui/src/tui/window_control.rs), which resolves the host terminal window (GetConsoleWindow, else GetForegroundWindow, else an EnumWindows/toolhelp walk of the parent chain) and drives it with synchronous SetWindowPos / ShowWindow. That HWND belongs to another process, so those calls are delivered to its window thread and block until it pumps messages. On a headless CI window station nothing pumps, which is how two dispatch-everything tests hung for 600 s; on a real desktop a busy or hung terminal host would stall the TUI's own thread the same way.

#5922 only skips /pin in the Windows dispatch-smoke tests and adds a per-command watchdog. The product fix is here:

  • Use SWP_ASYNCWINDOWPOS and ShowWindowAsync (or issue the calls from a dedicated thread with a bounded wait) so the TUI thread never blocks on another process's message pump.
  • Keep the existing apply-verify-retry logic truthful under the async calls: verify the resulting window state after a bounded wait and report pinned/not pinned from what was observed, never from the request.
  • Re-enable /pin in the Windows dispatch-smoke tests once the call cannot block.

Only checkable on windows-latest CI or a Windows host.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    • Status
      Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions