Skip to content

Pasted command gets a stray 1R prefix after returning to a terminal #48

Description

@iamnbutler

While preparing a canary release in Ace, an existing terminal prefixed a pasted command with stray characters. The command failed until the prompt was cleared.

Observed sequence

  1. Switch from another channel to keen-orbit.
  2. Select its existing term tab.
  3. Paste and run:
    sh /tmp/ace-canary-preflight.sh > /tmp/ace-canary-preflight.log 2>&1
  4. The redirected log reports zsh: command not found: 1Rsh.
  5. Clear the prompt with Ctrl+U, then paste and run the same command again. It succeeds.

This was observed once during dogfooding. The exact incoming/outgoing terminal bytes were not captured, and the successful retry replaced the redirected log. The failure is observed; the explanation below is not confirmed.

Suspected replay interaction

  • Host terminal output is retained as raw PTY chunks. Reattachment replays those chunks without identifying a replay boundary.
  • The client input listener forwards every xterm onData event to the live PTY. During reattachment, that listener is active while the client resets xterm and writes replayed output.
  • Installed xterm source (src/common/InputHandler.ts:2653 and src/common/services/CoreService.ts:61) answers a cursor-position query (CSI 6 n) with CSI row;column R through the same onData event. Replaying an old query could therefore send an unsolicited response into the current shell prompt. The 1R suffix is consistent with that possibility, but does not prove it.

Normal tab selection keeps panels mounted; returning to a channel and first viewing its restored terminal can reattach it. Reconnection also reattaches. Do not assume every tab switch triggers replay.

Expected

  • Returning to an existing terminal must leave the live shell input unchanged; the first pasted command must run exactly as entered.
  • Investigate raw-output replay and generated terminal responses. Preserve responses to live queries while preventing historical output from generating new shell input.
  • Verify channel navigation, reload/reconnect, normal typing and pasting, and live terminal queries with a real shell.

No matching open or closed issue was found in the repository. Related terminal issues #11 and #18 cover different work. Tracked by #5.

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