Skip to content

fix(input): preserve wheel capture across lease handover - #347

Merged
tkhquang merged 2 commits into
mainfrom
fix/wheel-host-lease-handover
Aug 27, 2026
Merged

fix(input): preserve wheel capture across lease handover#347
tkhquang merged 2 commits into
mainfrom
fix/wheel-host-lease-handover

Conversation

@tkhquang

@tkhquang tkhquang commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Install resident wheel hooks from a host-owned worker so capture survives retarget thread exit and lease handover.
  • Add focused regression and lifecycle resource coverage.
  • Update the wheel-host contract and bump the version to 4.1.1.

Summary by CodeRabbit

  • New Features

    • Improved hook mounting so it remains active after the requesting thread exits.
    • Added more reliable handling for startup, retargeting, and shutdown operations.
  • Bug Fixes

    • Improved cleanup of mounting resources during shutdown and failure scenarios.
    • Ensured successor operations can reuse an existing mounted route.
  • Documentation

    • Clarified thread ownership, mount persistence, and lifecycle behavior.
  • Tests

    • Expanded lifecycle coverage for mount persistence and resource cleanup.
    • Updated release validation for version 4.1.1.

@tkhquang tkhquang self-assigned this Aug 27, 2026
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c0985f0c-18aa-4620-9b1f-5479e9b36e88

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 707fbb3c-92a7-4f40-bee1-ae4f0fa303cf

📥 Commits

Reviewing files that changed from the base of the PR and between 35f143b and d4d7811.

📒 Files selected for processing (7)
  • CMakeLists.txt
  • docs/tests/README.md
  • include/DetourModKit/abi/wheel_host.h
  • src/wheel_host/wheel_host.cpp
  • tests/lifecycle/staged_generation_soak.cpp
  • tests/test_version.cpp
  • tests/wheel_host_isolated_proof.cpp

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The wheel host now installs hooks through a host-owned worker thread. Startup, retarget, shutdown, snapshots, and lifecycle tests reflect the additional worker handle and mount persistence. The project version and version tests now use 4.1.1.

Changes

Wheel host mount worker

Layer / File(s) Summary
Worker mount flow
src/wheel_host/wheel_host.cpp
HostState stores worker resources. The worker receives mount requests, installs WH_GETMESSAGE hooks, and reports completion.
Worker lifecycle integration
src/wheel_host/wheel_host.cpp
Startup and retarget use the worker. Shutdown stops the worker before releasing the target-thread handle. Snapshots count both handles.
Mount persistence and cleanup validation
tests/wheel_host_isolated_proof.cpp, tests/lifecycle/staged_generation_soak.cpp, include/DetourModKit/abi/wheel_host.h, docs/tests/README.md
Tests verify persistence after the requesting thread exits, successor lease handover, zero handles after stop, and two handles during soak runs. Documentation states the worker ownership rules.

Release version update

Layer / File(s) Summary
Project and test version alignment
CMakeLists.txt, tests/test_version.cpp
The project version and version assertions now target 4.1.1. The next unreached patch is 4.1.2.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to d4d78

The PR updates wheel-hook lifetime handling and related tests and versioning; no actionable merge-blocking risk remains beyond normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant HostControl
  participant MountWorker
  participant TargetThread
  participant Lease
  HostControl->>MountWorker: request hook mount
  MountWorker->>TargetThread: install WH_GETMESSAGE hook
  TargetThread-->>MountWorker: return mounted hook
  MountWorker-->>HostControl: signal completion
  HostControl-->>Lease: expose ready mounted route
  Lease->>TargetThread: process wheel messages
Loading
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preserving wheel capture during lease handover. This matches the resident host worker, retarget, and lease-handover changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tkhquang
tkhquang merged commit 7ca9a03 into main Aug 27, 2026
17 checks passed
@tkhquang
tkhquang deleted the fix/wheel-host-lease-handover branch August 27, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant