Bump kanata engine: fast stuck-key recovery after VHID reconnect (MAL-57 Layer 2)#885
Conversation
Code Review: Bump kanata engine — fast stuck-key recovery (MAL-57 Layer 2)Summary: Submodule pointer bump ( ✅ What's solid
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d96f7e7181
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1 +1 @@ | |||
| Subproject commit 49b856a3bdeb66791b65eaad718f1e7b9fb95c59 | |||
| Subproject commit 6a05a4a3fea117eb1d240d9c77492fb9ed02f7d1 | |||
There was a problem hiding this comment.
Clear local report state before returning not-ready
When the VHID daemon is marked not ready before kanata processes the physical key-up, the vendored driverkit/c_src/driverkit.cpp returns 2 from send_key before updating its local keyboard.keys report cache. The macOS recovery path then clears Rust-side tracking while input is released, but this C++ cache still contains the pressed key; after this bump reuses the same client and resets the virtual keyboard on reconnect, the next emitted report can re-assert that stale key and make the stuck key come back. Please update the not-ready/recovery path to apply releases to the local report state or explicitly clear the C++ report caches before resuming output.
Useful? React with 👍 / 👎.
|
Addressing the review: #1 — Fast-forward proof (blocking):
No commits lost; the bundled lineage is strictly append-only. #3 — Held-key invariant reference (blocking): the guarantee is stronger than "reset is followed by a full-state report" — every report kanata posts is full-state by construction. The #2 — Heartbeat rationale: 1000ms was chosen to mirror the daemon's own per-client #4 — Load-test bound: agreed; the post-deploy verification will include a compile-load run alongside the clean Layer 3 tracking: filed as malpern/kanata#27. |
…-57 Layer 2) Pulls malpern/kanata#26 into the bundled engine: stable per-PID VHID client socket path, virtual_hid_keyboard_reset on the keyboard-ready rising edge, and 1s (was 3s) daemon heartbeat detection. Worst-case stuck-key autorepeat after a daemon connection loss drops from ~3s to ~1.5s, typical under 1s. Also reduces daemon stdout log volume ~95% (ready-status now logged on transitions only). Engine release build (cmd,tcp_server, aarch64) verified locally via Scripts/build-kanata.sh: signs and passes binary smoke test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
d96f7e7 to
49d5a07
Compare
Code Review — PR #885: Bump kanata engine (MAL-57 Layer 2)OverviewThis is a one-line submodule bump (
What's Good
Issues / Questions1. Fast-forward verification (required by CLAUDE.md)
The PR description doesn't explicitly confirm the 2. Socket path stability assumptionThe description says "stable per-PID client socket path". This is a meaningful guarantee only if the kanata process PID doesn't change across the reconnect window. Under launchd with 3. Residual gap: Layer 3 not addressed
4. Test plan scopeThe manual test — NitThe PR title says "fast stuck-key recovery" — the description makes clear worst-case is ~1.5s, not instant. "Bounded" or "shortened" would be more precise, though this is cosmetic. VerdictApprove with the fast-forward confirmation. The change is well-scoped, the causal chain is documented, and the fix is mechanically sound. The main ask is explicit confirmation that the |
Summary
Submodule bump pulling malpern/kanata#26 into the bundled engine — MAL-57 Layer 2 (Layer 1 was #882). When the kanata↔VHID-daemon socket dies mid-keystroke, a lost key Release no longer autorepeats for ~3 seconds:
virtual_hid_keyboard_reseton keyboard-ready rising edge — clears stuck keys as soon as the connection recovers; held keys survive because kanata's reports carry absolute full stateWorst-case burst ~3s → ~1.5s, typical <1s. Also cuts daemon stdout log volume ~95% (ready-status logged on transitions only — it was 183MB of once-per-second spam).
Implemented by vendoring karabiner-driverkit 0.3.1 inside the fork (
[patch.crates-io]); full causal chain indocs/bugs/MAL-57-duplicate-keypresses.md.Test plan
cargo testgreen on the fork branch;cargo build+ release engine build (Scripts/build-kanata.sh, cmd+tcp_server, aarch64) signs and passes binary smoke testsudo kill -STOPthe VHID daemon ~4s while holding a key,kill -CONT, confirm the repeat burst is bounded (~1s) and held modifiers survive; confirmvirtual_hid_keyboard_reset sent after ready transitionin the kanata log