Fix toasts on Windows under WSL 2
Before this: no notifications or toasts when using Codex CLI in WSL 2.
After this: I get toasts from Codex
Thanks for the contribution. We've updated our contribution guidelines to clarify that we're currently accepting contributions for bugs and security fixes, but we're not generally accepting new features at this time. We need to make sure that all new features compose well with both existing and upcoming features and fit into our roadmap. If you would like to propose a new feature, please file or upvote an enhancement request in the issue tracker. We will generally prioritize new features based on community feedback.
@dank-openai, there are some CI failures. Looks like simple lint (cargo clippy) issues — should be easy to fix.
@dank-openai, one more CI failure to fix — this time a code formatting issue in a docs file (prettier).
@dank-openai, looks like there's a merge conflict now. Can you resolve?
@codex review
@dank-openai, just wanted to give you an update on this PR. The codex team member who is most familiar with this part of the code case is away this week for the Thanksgiving holidays. I've asked him to review it when he's back at work next week.
Understood, thanks for the update.
because clicking on the notification won't do anything
This is true, I've experienced this myself.
we should use a crate like notify-rust or winrt-notification
I can look into those...
I investigated this further.
Triggering a notification requires launching a Windows executable such as PowerShell. Notifications cannot be issued directly from WSL. Using PowerShell removes the need to build a separate executable. Therefore, from a technical perspective, the Codex CLI must invoke an external process, and this PR satisfies that requirement.
Implementing functionality for the notification click to focus the originating terminal (for example, Windows Terminal) would require substantially more work. It would involve building a Windows-native executable, registering an AUMID/COM activator, invoking SetForegroundWindow, and, for Windows Terminal, running a command such as wt -w 0 focus-tab -t
In the current state, the Codex CLI lacks notifications, which reduces usability. This PR adds notification support, which improves functionality. The missing “click-to-focus” behavior is a limitation, but implementing it would introduce disproportionate complexity relative to the benefit.
Thanks @dank-openai. We're going to go ahead and merge this. We'll look to improve it in the future. In the meantime, a non-interactive toast is arguably better than nothing.