-
Notifications
You must be signed in to change notification settings - Fork 6.9k
FIX: WSL Paste image does not work #6793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
I close #5644 and create new PR. Last version have too many commit and merge |
|
Note To use Codex here, create an environment for this repo. |
…r Linux) new version
0ee6668 to
8d73a8b
Compare
why not use force push? There's no need to open a new PR for the same implementation. However, it seems the Codex team hasn’t really prioritized Windows support — even though both the community and the team themselves have provided fixes #6046 . |
I’m agree, but last PR have multiples problem. Fist commit update too many file, multiple change in some class. Yes the result is the same, but now is only the change and not multiple revert. Other PR have the problem of Codex isn’t sign the CLA. |
draft: feat: Better OS Detection, starting with windows openai#6046
Use is_probably_wsl Separate function: Clipboard Use chatwidget.rs Add key_hint::ctrl_alt
|
I think I forget nothing Rust-CI |
dylan-hurd-oai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking much better! Some final comments
clipboard_paste.rs: fallback for is_probably_wsl and remove public convert_windows_path_to_wsl
| }; | ||
|
|
||
| // normalize_pasted_path already handles Windows → WSL path conversion, | ||
| // so we can directly try to read the image dimensions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Waxime64 final clean-up, can we remove this comment?
|
@dylan-hurd-oai: That can be in other ticket. But I found a problem if "Windows interop is disabled". Example on Feudora. The hint to call powershell fail. |
|
Good find - thanks for investigating. Based on your report, it does not appear to be a regression - i.e. calls that failed before will continue to fail. Therefore I think we can proceed with this fix. Can you open up a new github issue for that specific problem so we can track the new PR accordingly? |
|
Nice! I'm so happy to see this merged! @Waxime64, thanks again for the contribution. We really appreciate your diligence and persistence on this one. |




Related issues:
Area:
codex-cli(image handling / clipboard & file uploads)Platforms affected: WSL (Ubuntu on Windows 10/11). No behavior change on native Linux/macOS/Windows.
Summary
This PR fixes image pasting and file uploads when running
codex-cliinside WSL. Previously, image operations failed silently or with permission errors because paths weren't properly mapped between Windows and WSL filesystems.Visual Result
Last Rust-Cli
Root cause
The CLI assumed native Linux/Windows environments and didn't handle the WSL↔Windows boundary:
C:\...) and WSL (/mnt/c/...)Why
Ctrl+Vdoesn't work in WSL terminalsMost WSL terminal emulators (Windows Terminal, ConEmu, etc.) intercept
Ctrl+Vat the terminal level to paste text from the Windows clipboard. This keypress never reaches the CLI application itself, so our clipboard image handler never gets triggered. Users needCtrl+Alt+V.Changes
WSL detection & path mapping
/proc/sys/kernel/osreleaseand theWSL_INTEROPenv varC:\...→/mnt/c/...)Clipboard fallback for WSL
UI improvements
Ctrl+Alt+Vhint on WSL (many terminals intercept plainCtrl+V)Performance
Files changed
protocol/src/lib.rs– Added platform detection moduleprotocol/src/models.rs– Added WSL path mapping for local imagesprotocol/src/platform.rs– New module with WSL detection utilitiestui/src/bottom_pane/chat_composer.rs– Added base64 data URL support and WSL path mappingtui/src/bottom_pane/footer.rs– WSL-aware keyboard shortcutstui/src/clipboard_paste.rs– PowerShell clipboard fallbackHow to reproduce the original bug (pre-fix)
codex-cliinside WSL2 on Windows.C:\...into the terminal.How to verify the fix
codex-cliinside WSL2.I’m happy to adjust paths, naming, or split helpers into a separate module if you prefer.
How to try this branch
If you want to try this before it’s merged, you can use my Git branch:
Repository: https://github.com/Waxime64/codex.git
Branch:
wsl-image-2cargo build -p codex-tui --bin codex-tui --release
sudo install -m 0755 target/release/codex-tui /usr/local/bin/codex
cd /path/to/your/project
/usr/local/bin/codex
On WSL, use CTRL+ALT+V to paste an image from the Windows clipboard into the chat.