fix(tunnel): inject macOS desktop-tunnel keystrokes instead of dropping them (VA-138) #148

Merged
longjacksonle merged 1 commit from fix/VA-138-macos-tunnel-keysym into main 2026-07-15 19:45:17 +02:00

Fixes VA-138: macOS keyboard input over the Desktop tunnel was silently discarded.

Root cause

inject_keysym in host/tunnel.rs dispatched key events per-OS with a #[cfg(not(any(target_os = "linux", target_os = "windows")))] fall-through arm that dropped the event (let _ = (keysym, press);). VA-93 added the macOS vervain_agent_kvm::key_event (CGEvent keyboard injection, taking a keysym name like the Windows backend) but did not update this dispatch, so macOS hit the discard arm. Mouse input was unaffected: it flows through pointer::inject, whose non-Linux fallback already calls the macOS mouse_move/mouse_button backends.

Fix

Fold macOS into the Windows named-keysym arm (any(target_os = "windows", target_os = "macos")): both resolve the keysym to a name via keymap::keysym_to_name and pass it to key_event, which the native backend maps (SendInput on Windows, CGEvent on macOS). The fall-through discard arm now covers only genuinely unsupported platforms. Ten-line change in one function.

Validation

  • Linux + Windows key paths unchanged (the edit only widens the named-keysym arm to macOS and narrows the fall-through).
  • Full workspace clippy --deny warnings and fmt clean on Linux.
  • The macOS arm is byte-identical to the already-compiling Windows arm and calls keymap::keysym_to_name + key_event, both unconditional exports validated to compile for apple-darwin in VA-93.
  • Runtime (keys land over the Desktop tunnel on macOS) is validated on a real Mac alongside the VA-93 KVM check.

🤖 Generated with Claude Code

Fixes VA-138: macOS keyboard input over the Desktop tunnel was silently discarded. ## Root cause `inject_keysym` in `host/tunnel.rs` dispatched key events per-OS with a `#[cfg(not(any(target_os = "linux", target_os = "windows")))]` fall-through arm that dropped the event (`let _ = (keysym, press);`). VA-93 added the macOS `vervain_agent_kvm::key_event` (CGEvent keyboard injection, taking a keysym name like the Windows backend) but did not update this dispatch, so macOS hit the discard arm. Mouse input was unaffected: it flows through `pointer::inject`, whose non-Linux fallback already calls the macOS `mouse_move`/`mouse_button` backends. ## Fix Fold macOS into the Windows named-keysym arm (`any(target_os = "windows", target_os = "macos")`): both resolve the keysym to a name via `keymap::keysym_to_name` and pass it to `key_event`, which the native backend maps (`SendInput` on Windows, CGEvent on macOS). The fall-through discard arm now covers only genuinely unsupported platforms. Ten-line change in one function. ## Validation - Linux + Windows key paths unchanged (the edit only widens the named-keysym arm to macOS and narrows the fall-through). - Full workspace `clippy --deny warnings` and `fmt` clean on Linux. - The macOS arm is byte-identical to the already-compiling Windows arm and calls `keymap::keysym_to_name` + `key_event`, both unconditional exports validated to compile for apple-darwin in VA-93. - Runtime (keys land over the Desktop tunnel on macOS) is validated on a real Mac alongside the VA-93 KVM check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(tunnel): inject macOS desktop-tunnel keystrokes instead of dropping them (VA-138)
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 5m13s
Create release / Create release from merged PR (pull_request) Has been skipped
47a08bd55d
`inject_keysym` routed key events per-OS with a `not(any(linux, windows))` fall-through arm that discarded the event. VA-93 added the macOS `vervain_agent_kvm::key_event` (CGEvent keyboard injection) but did not update this dispatch, so macOS took the discard arm and remote keyboard input over the Desktop tunnel did nothing, even though the backend existed. Mouse input was unaffected: it flows through `pointer::inject`, whose non-Linux fallback already calls the macOS `mouse_move`/`mouse_button` backends.

Fold macOS into the Windows named-keysym arm: both resolve the X11 keysym to a name via `keymap::keysym_to_name` and hand it to `key_event`, which the native backend maps (`SendInput` on Windows, CGEvent on macOS). The discard arm now covers only genuinely unsupported platforms.

Linux and Windows key paths are unchanged (the edit only widens the named-keysym arm to macOS and narrows the fall-through). Verified with the full workspace clippy `--deny warnings` and fmt on Linux; the macOS arm mirrors the already-compiling Windows arm and calls `keymap::keysym_to_name` + `key_event`, both unconditional macOS-available exports validated to compile for apple-darwin in VA-93. Runtime keyboard-over-tunnel behavior is validated on a real Mac alongside the VA-93 KVM check.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYb1fkK32XQdwkGkStxXR9
Signed-off-by: longjacksonle <longjacksonle@gmail.com>
longjacksonle deleted branch fix/VA-138-macos-tunnel-keysym 2026-07-15 19:45:17 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-agent!148
No description provided.