Skip to content

viewer: input releases are lost when the injector drops its connection #407

Closed

Description

@ElbertePlinio

Found in the release dry run 40751708690 for PR #400. The Rust gates failed in crates/pickforge-viewer/tests/inject_xvfb.rs > drop_releases_held_input: after the injector was dropped, Control_L (keycode 37) was still down, and sometimes the middle button too.

Injector::release_all in crates/pickforge-viewer/src/input.rs sends the XTEST releases and flushes. Drop then closes the connection. The X server can discard requests that a closed connection left unread, so the releases are lost and the keys stay down on the session display. The agent's next input then runs with a stuck modifier.

Reproduced locally: the injector suite on Xvfb, 60 runs with every CPU busy, failed 8 times in drop_releases_held_input. With a reply round trip after the releases, it failed 0 of 60 times there.

The same runs showed a test-only race in revoke_releases_held_input_and_stops_sending: the listener can query the key state before the server handles the injector's presses (2 of 60 runs).

  • Make release_all wait for a reply before it returns
  • Make the revoke test wait for the pressed state instead of asserting it at once

Activity

  1. added 2 commits that reference this issue on Oct 28, 2026
    851cf09
    0347736
  2. ElbertePlinio commented on Oct 28, 2026

    @ElbertePlinio
    MemberAuthor

    Fixed in #400: on drop, the injector arms a 1 s watchdog, releases held input, and waits for a reply. Not changed here: revoke, Return control, close and focus loss still release with a plain flush, as before. Like every other input call, that flush can block if the session server stops reading and the send queue fills.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions