Skip to content

fix(engine): preserve the remote off reason during teardown #1920

Closed

Description

@LHagfoss

Problem

The device can receive session_closed with reason owner_exited after an explicit /remote off, where the end-to-end contract expects sharing_disabled. Sharing does stop, but the client loses the reason the user requested.

Evidence

  • Linux CI for PR fix(tui): show remote pairing in a full-height panel #1919 at 3a6dd8d287422778ac7c1d298d2673b94d9fba67, first attempt: failed test job.
  • remote_gateway::e2e_tests::a_paired_device_drives_a_shared_session_end_to_end failed at rustcode/engine/src/remote_gateway/e2e_tests.rs:700: actual "owner_exited", expected "sharing_disabled".
  • PR fix(tui): show remote pairing in a full-height panel #1919 changes pairing presentation and panel rendering; it does not modify the gateway routing, owner transport, or this test.
  • The full macOS workspace suite passed on the PR branch with four test threads. The failing case passed in isolation on unchanged main (84f3d99b) on 2026-10-09. This points to intermittent behavior; a concrete root cause is not confirmed.
  • The test terminal's off sends OwnerMessage::Unregister { reason: SharingDisabled } and exits its task. The owner client writes that frame and returns; the gateway uses owner_exited when the connection ends without processing a close reason. An ordering issue during teardown is a hypothesis, not a verified diagnosis.

Acceptance criteria

  • Explicit /remote off preserves sharing_disabled through terminal → owner connection → gateway → device while clearing the session listing.
  • Abrupt owner loss continues to report owner_exited.
  • A deterministic regression covers the confirmed cause; repeated share/off cycles pass under concurrent gateway activity and on Linux CI.
  • Do not weaken the assertion to accept both reasons without making that an explicit protocol decision.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions