Skip to content

server: mirrored-pane typing is not cancelled by a detach or reattach before its queue drains #546

Closed

Description

@devswha

What

On a Windows mirror (terminalAttachKnown === false, or the first input before it is known), typed text goes through the mirror branch of the input handler in server/index.ts: it waits its turn in serialize(...), shapes the text with mirrorInput, checks that the connection still exists and authorizeSocket, then calls paneSendText. It never captures or re-checks the sender's attachment claim or membership, which the pty branch and the keys handler do since #508.

So on a mirrored pane: queue text behind another operation, detach the pane and switch, or detach and reattach, before the queue drains. The text still reaches the pane it was typed into.

Where

server/index.ts, case "input", the branch guarded by terminalAttachKnown === false || (!attachment && terminalAttachKnown === null).

Possible fix

Capture client.data.attached.get(pane_id) and the attachment before the queue, and apply the same claim, attachment identity and sender-membership checks inside the queued step, after the asynchronous shaping. The contract test can simulate the mirror on Linux as server/submit.contract.test.ts does.

Found by

Codex gpt-6.1-sol adversarial review of #508 at 471db0c (Medium). Pre-existing branch; #508 did not touch it.

Activity

  1. added a commit that references this issue on Oct 8, 2026
    9f097f0
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