Skip to content

tmux inside an AWS SSM session forces white cursor #18695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NicosGollan-cnic opened this issue Mar 17, 2025 · 8 comments
Closed

tmux inside an AWS SSM session forces white cursor #18695

NicosGollan-cnic opened this issue Mar 17, 2025 · 8 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@NicosGollan-cnic
Copy link

Windows Terminal version

1.21.10351.0

Windows build number

10.0.26100.0

Other Software

gossm v1.5.0
tmux 3.0a
ubuntu 20.04, 22.04, 24.04

Steps to reproduce

  • Inside a WSL Linux session in Terminal (Ubuntu)
  • Connect to an AWS EC2 instance running Ubuntu 20.04
    Image
  • Start a tmux session
    Image

Expected Behavior

I expect the cursor colour to remain the same. Normally, I have a dark blue cursor on a light background.

Actual Behavior

The cursor is forced to pure white when starting or terminating the tmux session.

Opening Terminal settings and saving them without any changes restores the cursor to the intended colour, and it remains that way for the remainder of the tmux session.

This does not happen when running tmux "natively" in the "parent" WSL terminal, so far I only encountered the behaviour when running tmux in an SSM session.

@NicosGollan-cnic NicosGollan-cnic added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 17, 2025
@lhecker
Copy link
Member

lhecker commented Mar 19, 2025

Thanks! Would you mind grabbing us the output of the debug tab? https://github.com/microsoft/terminal/wiki/Troubleshooting-Tips#enabling-the-debug-tap

In particular, look out for OSC 12: ␛]12.

@NicosGollan-cnic
Copy link
Author

Hey, thanks for the response, below is what happens when I start tmux in a gossm-initiated session, starting with the prompt where I enter "tmux". I hope that's enough since I don't exactly feel like redacting various IDs from a tonne of raw ANSI terminal :-)

In particular, after sending the prompt, there appears to be this sequence before it runs off to the tmux status line, starting with the "$ " of the prompt: $␣␛[O␛[?12l␛[?25l␛[30m␛[42m

␛[13;28;13;0;32;1_␛[32m␛[1mapp@cron␛[m:␛[34m␛[1m/var/snap/amazon-ssm-agent/9881␛[m$␣␛]0;app@cron:␣/var/snap/amazon-ssm-agent/9881␇␛[84;20;116;1;32;1_t␛[84;20;116;0;32;1_␛[77;50;109;1;32;1_m␛[77;50;109;0;32;1_␛[85;22;117;1;32;1_u␛[85;22;117;0;32;1_␛[88;45;120;1;32;1_x␛[88;45;120;0;32;1_␛[32;57;32;1;32;1_␣␛[32;57;32;0;32;1_␛[13;28;13;1;32;1_␍␊
␛[?1049h␛[22;0;0t␛[?1h␛=␛[2J␛[?12l␛[?1000l␛[?1002l␛[?1006l␛[?1005l␛[?12;25h␛[?12l␛[?1003l␛[?1006l␛[?2004l␛]112␇␛[?25l␛[H␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␛[H␛[?25h␛[13;28;13;0;32;1_␛[?12l␛[?12;25h␛[?12l␛[?1003l␛[?1006l␛[?2004l␛[?12l␛[?25l␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␍␊
␛[K␛[30m␛[42m␍␊
[33]␣0:tmux*␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣"cron.eu-central-1a.li"␣08:08␣20-Mar-25␛[H␛[?25h␛[mapp@cron:/var/snap/amazon-ssm-agent/9881$␣␛[O␛[?12l␛[?25l␛[30m␛[42m␛[68;1H[33]␣0:bash*␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣"cron.eu-central-1a.li"␣08:08␣20-Mar-25␛[1;43H␛[?25h␛[I␛[?12l␛[?25l␛[m␛[30m␛[42m␛[68;1H[33]␣0:bash*␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣␣"cron.eu-central-1a.li"␣08:09␣20-Mar-25␛[1;43H␛[?25h␛[O

@DHowett
Copy link
Member

DHowett commented Mar 26, 2025

Hey, funny enough... this is something we expressly added support for!

I see ␛]112␇ in your trace output.

According to the big document of control sequences, this is the code for "Reset Cursor Color". Something in your remote config is requesting that we reset the cursor color.

@DHowett DHowett closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2025
@DHowett DHowett added the Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. label Mar 26, 2025
@DHowett
Copy link
Member

DHowett commented Mar 26, 2025

FWIW,

Image

@NicosGollan-cnic
Copy link
Author

What does it "reset to" though? By default, I have that dark blue colour everywhere, and saving settings even restores it, so my expectation would be that any "reset" would restore it to that dark colour instead of white.

DHowett added a commit that referenced this issue Mar 27, 2025
@DHowett
Copy link
Member

DHowett commented Mar 27, 2025

You know what? You're right. It's resetting to a built-in default because we don't actually fully support the reset OSC.

We're tracking that over in /dup #3719, and I just started work on it (you caught me on a bored Thursday with some extra time...)

Copy link
Contributor

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@microsoft-github-policy-service microsoft-github-policy-service bot added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 27, 2025
@DHowett
Copy link
Member

DHowett commented Mar 27, 2025

For what it's worth, it looks like the Windows Console has always implemented it this way! Back in the original commit in this repository, it seems like we implemented the reset cursor color OSC by way of "set it to all white" (actually, INVALID_COLOR -- which triggers it to reset to invert rather than white).

This may not have always applied to Terminal because the console host was filtering it out. Now that there is no filtering, Terminal is exposed to a lot more...

DHowett added a commit that referenced this issue Apr 10, 2025
This pull request adds support for resetting the various color table
entries and xterm resource values back to their defaults.

Building on the default color table James introduced in #17879, it was
relatively straightforward to add support for resetting specific
entries.

This implementation cleaves tightly to observed behavior in xterm(379)
rather than observed behavior in libvte(0.70.6). They differ in the
following ways:

- xterm rejects any OSC [110..119] with any number of parameters; libvte
accepts it but only resets the first color.
- When passed a list of color indices to reset in 104, xterm resets any
colors up until the first one which fails to parse as an integer and
does _not_ reset the rest; libvte resets all parseable color indices.

I was unable to verify how these reset commands interact with colors set
via `DECAC Assign Color` so I went with the implementation that made the
most sense:

- Resetting the background color with `110` also restores the background
color alias entry to its pre-`DECAC` value; this results in the
perceived background color returning to e.g. index 0 in conhost and the
`background` color in Terminal.
- _ibid._ for the foreground color

Refs #18695
Refs #17879
Closes #3719
DHowett added a commit that referenced this issue Apr 21, 2025
This pull request adds support for resetting the various color table
entries and xterm resource values back to their defaults.

Building on the default color table James introduced in #17879, it was
relatively straightforward to add support for resetting specific
entries.

This implementation cleaves tightly to observed behavior in xterm(379)
rather than observed behavior in libvte(0.70.6). They differ in the
following ways:

- xterm rejects any OSC [110..119] with any number of parameters; libvte
accepts it but only resets the first color.
- When passed a list of color indices to reset in 104, xterm resets any
colors up until the first one which fails to parse as an integer and
does _not_ reset the rest; libvte resets all parseable color indices.

I was unable to verify how these reset commands interact with colors set
via `DECAC Assign Color` so I went with the implementation that made the
most sense:

- Resetting the background color with `110` also restores the background
color alias entry to its pre-`DECAC` value; this results in the
perceived background color returning to e.g. index 0 in conhost and the
`background` color in Terminal.
- _ibid._ for the foreground color

Refs #18695
Refs #17879
Closes #3719

(cherry picked from commit 5f31150)
Service-Card-Id: PVTI_lADOAF3p4s4AmhmQzgZOWsU
Service-Version: 1.22
DHowett added a commit that referenced this issue Apr 21, 2025
This pull request adds support for resetting the various color table
entries and xterm resource values back to their defaults.

Building on the default color table James introduced in #17879, it was
relatively straightforward to add support for resetting specific
entries.

This implementation cleaves tightly to observed behavior in xterm(379)
rather than observed behavior in libvte(0.70.6). They differ in the
following ways:

- xterm rejects any OSC [110..119] with any number of parameters; libvte
accepts it but only resets the first color.
- When passed a list of color indices to reset in 104, xterm resets any
colors up until the first one which fails to parse as an integer and
does _not_ reset the rest; libvte resets all parseable color indices.

I was unable to verify how these reset commands interact with colors set
via `DECAC Assign Color` so I went with the implementation that made the
most sense:

- Resetting the background color with `110` also restores the background
color alias entry to its pre-`DECAC` value; this results in the
perceived background color returning to e.g. index 0 in conhost and the
`background` color in Terminal.
- _ibid._ for the foreground color

Refs #18695
Refs #17879
Closes #3719

(cherry picked from commit 5f31150)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgZOWsQ
Service-Version: 1.23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-By-Design It's supposed to be this way. Sometimes for compatibility reasons. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants