fix(cua-driver/linux): fail loudly when X11 input can't be delivered on pure Wayland (#1921) - #1994
Conversation
…on pure Wayland (#1921) On a pure-Wayland session (WAYLAND_DISPLAY set, no DISPLAY) with the native Wayland backend not opted in, every input tool routed to the X11 XSendEvent path, which cannot deliver events without an X server — yet the failure was a cryptic x11rb connect error at best and a silent false-success at worst. An agent then believes its clicks/keys landed when nothing happened. - Add wayland::wayland_input_unavailable_reason(): Some(actionable msg) only on a pure Wayland session with the backend off; None for X11/XWayland. - Route all 10 X11 input connect sites through connect_x11_for_input(), which bails with that reason instead of attempting X11, and otherwise surfaces DISPLAY on any connect failure so the cause is diagnosable. Addresses the issue's 'fail loudly rather than fall through to the X11 no-op and report success' direction. Wiring native zwlr_virtual_pointer as the default remains the larger #1910 follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KMXCW4M5uK1HRGjjH4wueZ
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds a ChangesX11 Input Preflight Checks
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Linux visual regression artifactsMatrix jobs now run independently. Download visual artifacts from this workflow run.
|
Problem
On a native-Wayland session (
WAYLAND_DISPLAYset, noDISPLAY),clickreturns✅ Clicked at (x,y)but no pointer input is delivered —straceshows zero pointer events. Silent false-success: the agent believes its clicks landed when nothing happened. Fixes #1921 (the near-term half).Root cause
The native-Wayland backend (
zwlr_virtual_pointerinput) is opt-in —is_wayland()is false unlessCUA_DRIVER_RS_ENABLE_WAYLAND=1. So on a pure-Wayland box without that env, every input tool routes to the X11XSendEventpath, which cannot deliver events with no X server — yet the failure surfaced as a cryptic connect error at best, or a silent success at worst.Fix (issue's recommended "fail loudly" direction)
wayland::wayland_input_unavailable_reason()→Some(actionable msg)only on a pure-Wayland session with the backend off;Nonefor X11 and XWayland (whereDISPLAYis set), so those paths are untouched.input::connect_x11_for_input()wraps the X11 connect: it bails with that reason instead of attempting a doomed X11 injection, and otherwise surfacesDISPLAYon any connect failure. All 10 X11 input connect sites (click, drag, type, press-key, focus, …) now route through it.Result: on pure Wayland without the backend, input tools return a clear "input cannot be delivered: pure Wayland session… set CUA_DRIVER_RS_ENABLE_WAYLAND=1 …or run under XWayland" error rather than reporting a false success. Wiring native
zwlr_virtual_pointeras the default remains the larger #1910 follow-up.Verification
cargo build -p platform-linuxrecompiled green (helper + all 10 routed sites present). Default features.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Improvements