Garbage characters printed when attaching remote tmux session #22953

Closed
opened 2026-01-31 08:28:15 +00:00 by claunia · 6 comments
Owner

Originally created by @naftasantos on GitHub (Feb 20, 2025).

Windows Terminal version

1.22.10352.0

Windows build number

10.0.26100.0

Other Software

I work on a remote linux development instance. On that instance, I use tmux a lot. Recently (I'm not really sure after which update) whenever I connect to either a new or an existing tmux session, the following characters are printed on my terminal:

10;rgb:ffff/ffff/ffff

Based on this issue posted on the tmux github, this seems to be a terminal issue (in their case rxvt).

This seems to be related with something unicode. I changed a few settings on my tmux like set -g terminal-overrides ",xterm-256color:Tc" and setting set -g focus-events off. But none seem to have fixed the issue.

Given the previous issue, and the fact that this started happening recently, I suspect it's a new feature from the Terminal.

Steps to reproduce

My setup:

  • Local Windows 11 (version mentioned on the windows version specific field)
  • Remote Amazon Linux 2 instance
  • zsh with oh-my-zsh and p10k theme
  • tmux with oh-my-tmux config

SSH to the remote host, attach a session.

Expected Behavior

When attaching the session, no characters should be printed.

Actual Behavior

Characters will be printed on the shell.

Originally created by @naftasantos on GitHub (Feb 20, 2025). ### Windows Terminal version 1.22.10352.0 ### Windows build number 10.0.26100.0 ### Other Software I work on a remote linux development instance. On that instance, I use `tmux` a lot. Recently (I'm not really sure after which update) whenever I connect to either a new or an existing tmux session, the following characters are printed on my terminal: ``` 10;rgb:ffff/ffff/ffff ``` Based on [this issue](https://github.com/tmux/tmux/issues/3852) posted on the tmux github, this seems to be a terminal issue (in their case `rxvt`). This seems to be related with something unicode. I changed a few settings on my tmux like `set -g terminal-overrides ",xterm-256color:Tc"` and setting `set -g focus-events off`. But none seem to have fixed the issue. Given the previous issue, and the fact that this started happening recently, I suspect it's a new feature from the `Terminal`. ### Steps to reproduce My setup: * Local Windows 11 (version mentioned on the windows version specific field) * Remote Amazon Linux 2 instance * zsh with oh-my-zsh and p10k theme * tmux with [oh-my-tmux config](https://github.com/gpakosz/.tmux) SSH to the remote host, attach a session. ### Expected Behavior When attaching the session, no characters should be printed. ### Actual Behavior Characters will be printed on the shell.
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:28:15 +00:00
Author
Owner

@itszn commented on GitHub (Feb 20, 2025):

Same issue here, this happens constantly.

It seems to happen most often when resizing a page (ie alt+f or alt+enter)

@itszn commented on GitHub (Feb 20, 2025): Same issue here, this happens constantly. It seems to happen most often when resizing a page (ie alt+f or alt+enter)
Author
Owner

@j4james commented on GitHub (Feb 20, 2025):

This is a duplicate of #18004. I think this is probably the result of tmux changing the default escape-time recently (see https://github.com/microsoft/terminal/issues/18004#issuecomment-2651799118 for more details). You can try setting that back to a more sensible value and see if it makes any difference, i.e. add something like set -sg escape-time 500 in your .tmux.conf file.

@j4james commented on GitHub (Feb 20, 2025): This is a duplicate of #18004. I think this is probably the result of tmux changing the default `escape-time` recently (see https://github.com/microsoft/terminal/issues/18004#issuecomment-2651799118 for more details). You can try setting that back to a more sensible value and see if it makes any difference, i.e. add something like `set -sg escape-time 500` in your `.tmux.conf` file.
Author
Owner

@naftasantos commented on GitHub (Feb 20, 2025):

Updating escape-time worked for me. For refence, I also had to disable focus-events:

set -g focus-events off

Otherwise other characters would show up, for example:

61;4;6;7;14;21;22;23;24;28;32;42c0;10;1c

Thanks!

@naftasantos commented on GitHub (Feb 20, 2025): Updating `escape-time` worked for me. For refence, I also had to disable `focus-events`: ``` set -g focus-events off ``` Otherwise other characters would show up, for example: ``` 61;4;6;7;14;21;22;23;24;28;32;42c0;10;1c ``` Thanks!
Author
Owner

@DHowett commented on GitHub (Sep 26, 2025):

Probably because the new conpty stack implementation is bugged at win10 os level (whilst legacy conhost avoids the issue).

Windows Terminal comes with its own ConPTY, which is always up-to-date. It is not subject to the bugs found in the OS version.

@DHowett commented on GitHub (Sep 26, 2025): > Probably because the new conpty stack implementation is bugged at win10 os level (whilst legacy conhost avoids the issue). Windows Terminal comes with its own ConPTY, which is always up-to-date. It is not subject to the bugs found in the OS version.
Author
Owner

@DHowett commented on GitHub (Sep 26, 2025):

I’m perfectly aware that ConPTY is part of the WT open-source repo.
My point in that sentence was that, even though the host code is open, it still relies on the underlying OS API in the backend.

Considering that you are wrong, I do not think your awareness is as perfect as you think it is.

Windows Terminal does not rely on the underlying OS API.

It does not import kernel32!CreatePseudoConsole, it does not spawn conhost.exe, and it does not use any of the OS APIs for console hosting. None of them. Not one.

The entire implementation of console session hosting is undocked from the OS. It runs perfectly fine on Windows 8.1 where those APIs don't even exist.

I appreciate what you're trying to do here, and that you're trying to help diagnose an issue that is bothering you, but hyper-specificity only helps if it is correct.

@DHowett commented on GitHub (Sep 26, 2025): > I’m perfectly aware that ConPTY is part of the WT open-source repo. > My point in that sentence was that, even though the host code is open, it still relies on the underlying OS API in the backend. Considering that you are wrong, I do not think your awareness is as perfect as you think it is. Windows Terminal **does not rely on the underlying OS API**. It does not import `kernel32!CreatePseudoConsole`, it does not spawn `conhost.exe`, and it does not use any of the OS APIs for console hosting. None of them. Not one. The entire implementation of console session hosting is undocked from the OS. It runs perfectly fine on Windows 8.1 where those APIs _don't even exist._ I appreciate what you're trying to do here, and that you're trying to help diagnose an issue that is bothering you, but hyper-specificity only helps if it is correct.
Author
Owner

@DHowett commented on GitHub (Sep 26, 2025):

For reference (and for anybody who finds this thread in the future):

ConptyCreatePseudoConsole is the fully undocked version of the "underlying OS API"s. It lives here:

05a4afcf35/src/winconpty/winconpty.cpp (L432-L439)

... and it is called here ...

05a4afcf35/src/cascadia/TerminalConnection/ConptyConnection.cpp (L408)

... in TerminalConnection!ConptyConnection::Start.

Now, you might be wondering "Well isn't ConptyCreatePseudoConsoleAsUser just the underlying OS API?" No, it's defined here:

05a4afcf35/src/winconpty/winconpty.cpp (L441-L453)

It's implemented in terms of CreateProcess (pictured here inside _CreatePseudoConsole)

05a4afcf35/src/winconpty/winconpty.cpp (L229-L241)

... of a console host that also doesn't come from the OS:

05a4afcf35/src/winconpty/winconpty.cpp (L47-L70)

@DHowett commented on GitHub (Sep 26, 2025): For reference (and for anybody who finds this thread in the future): `ConptyCreatePseudoConsole` is the fully undocked version of the "underlying OS API"s. It lives here: https://github.com/microsoft/terminal/blob/05a4afcf35ab287f0a72015d162067a66973e311/src/winconpty/winconpty.cpp#L432-L439 ... and it is called here ... https://github.com/microsoft/terminal/blob/05a4afcf35ab287f0a72015d162067a66973e311/src/cascadia/TerminalConnection/ConptyConnection.cpp#L408 ... in `TerminalConnection!ConptyConnection::Start`. Now, you might be wondering "Well isn't ConptyCreatePseudoConsoleAsUser just the underlying OS API?" No, it's defined here: https://github.com/microsoft/terminal/blob/05a4afcf35ab287f0a72015d162067a66973e311/src/winconpty/winconpty.cpp#L441-L453 It's implemented in terms of `CreateProcess` (pictured here inside `_CreatePseudoConsole`) https://github.com/microsoft/terminal/blob/05a4afcf35ab287f0a72015d162067a66973e311/src/winconpty/winconpty.cpp#L229-L241 ... of a console host that also doesn't come from the OS: https://github.com/microsoft/terminal/blob/05a4afcf35ab287f0a72015d162067a66973e311/src/winconpty/winconpty.cpp#L47-L70
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22953