Skip to content

[Runner] Log Windows session-end reason - #50273

Draft
Yu Leng (moooyo) wants to merge 1 commit into
microsoft:mainfrom
moooyo:codex/log-runner-session-end-reason
Draft

[Runner] Log Windows session-end reason#50273
Yu Leng (moooyo) wants to merge 1 commit into
microsoft:mainfrom
moooyo:codex/log-runner-session-end-reason

Conversation

@moooyo

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Adds diagnostic logging for Windows session-end messages received by the PowerToys Runner tray window.

  • Logs WM_QUERYENDSESSION and WM_ENDSESSION.
  • Decodes ENDSESSION_CLOSEAPP, ENDSESSION_CRITICAL, and ENDSESSION_LOGOFF.
  • Records whether WM_ENDSESSION confirms or cancels session termination.
  • Keeps the existing session-end behavior unchanged.

Related investigation: #50169.

PR Checklist

  • Closes: PowerToys randomly exits #50169
  • Communication: I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected
  • Tests: Added/updated and all pass
  • Localization: No end-user-facing strings were added
  • Dev docs: Added/updated
  • New binaries: Added on the required places
  • Documentation updated: If checked, please file a pull request on the docs repo and link it here

Detailed Description of the Pull Request / Additional comments

PowerToys 0.100.2 reports show the Runner disappearing without a crash event while Command Palette remains active. One hypothesis is that the Runner receives a Windows session-end or Restart Manager close-app request.

The Runner tray window owns the main message loop and already handles these messages through handle_stateless_session_end_message. This change logs the message phase, raw flags, decoded reason, and confirmed/cancelled state before the existing handler runs. Runner log entries already include process and thread identifiers.

Validation Steps Performed

  • Ran git diff --check successfully.
  • Reviewed the change against the existing Runner session-end handling.
  • Build not run; this is a diagnostic logging-only change.

@github-actions github-actions Bot added the Product-General Refers to general PowerToys functionality label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-General Refers to general PowerToys functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerToys randomly exits

1 participant