New action Restart this tab in the tab's topbar context menu #23246

Open
opened 2026-01-31 08:36:32 +00:00 by claunia · 16 comments
Owner

Originally created by @vadimkantorov on GitHub (May 10, 2025).

Description of the new feature

Image

This is useful when a tab is completely hung because of hung ssh session in a tab (e.g. happens when you have ssh connection, shut the laptop lid, then wake it up without wifi). In this state of ssh blocking in some I/O (under WSLv1 Ubuntu 24.04), the tab does not respond to any input, including Ctrl + Z and one has to wait for minutes until it prints client_loop: send disconnect: Connection reset by peer (I'll try using also the tilde commands, but they won't work for some other non-ssh I/O blocked tab anyways). If it's possible to also send some Linux signal into the tab (Ctrl+C or Ctrl+Z)

It is then useful to be able to restart this particular tab to not need to start a new one and then move it with a mouse to keep the tab order the same

Proposed technical implementation details

No response


Regarding Duplicate tab: currently the new duplicate tab gets placed at the right end of the topbar, not next to the duplicate tab. I would suggest that it the new tab should be placed right after the original one - just like in Chrome

Originally created by @vadimkantorov on GitHub (May 10, 2025). ### Description of the new feature ![Image](https://github.com/user-attachments/assets/7852cca1-5e21-4e54-8a46-bca0d07cf40d) This is useful when a tab is completely hung because of hung `ssh` session in a tab (e.g. happens when you have ssh connection, shut the laptop lid, then wake it up without wifi). In this state of ssh blocking in some I/O (under WSLv1 Ubuntu 24.04), the tab does not respond to any input, including Ctrl + Z and one has to wait for minutes until it prints `client_loop: send disconnect: Connection reset by peer` (I'll try using also the tilde commands, but they won't work for some other non-ssh I/O blocked tab anyways). If it's possible to also send some Linux signal into the tab (Ctrl+C or Ctrl+Z) It is then useful to be able to restart this particular tab to not need to start a new one and then move it with a mouse to keep the tab order the same ### Proposed technical implementation details _No response_ --- Regarding `Duplicate tab`: currently the new duplicate tab gets placed at the right end of the topbar, not next to the duplicate tab. I would suggest that it the new tab should be placed right after the original one - just like in Chrome
Author
Owner

@DHowett commented on GitHub (May 10, 2025):

We should probably put it in the menu.

For now, you can get at it with the command palette under the name "restart connection".

@DHowett commented on GitHub (May 10, 2025): We should probably put it in the menu. For now, you can get at it with the command palette under the name "restart connection".
Author
Owner

@vadimkantorov commented on GitHub (May 11, 2025):

For Duplicate tab - also please consider creating the new tab right next to the old one (similar to Chrome) and not flushed to the right

And the other idea - is to be able to send some Linux signals (equivalent to Ctrl+C and Ctrl+Z) also directly from the context menu...

@vadimkantorov commented on GitHub (May 11, 2025): For `Duplicate tab` - also please consider creating the new tab right next to the old one (similar to Chrome) and not flushed to the right And the other idea - is to be able to send some Linux signals (equivalent to Ctrl+C and Ctrl+Z) also directly from the context menu...
Author
Owner

@jamespack commented on GitHub (May 26, 2025):

It looks like there is already code there for it here

@jamespack commented on GitHub (May 26, 2025): It looks like there is already code there for it [here](https://github.com/microsoft/terminal/blob/main/src/cascadia/TerminalApp/TerminalTab.cpp#L1499-L1518)
Author
Owner

@jamespack commented on GitHub (May 26, 2025):

Yea unless Im reading this wrong, this functionality already exists. If the current tab's connection IsClosed() it sets that menu Items Visibility to Visibile. Otherwise its Collapsed. Maybe there is a bug?

@jamespack commented on GitHub (May 26, 2025): Yea unless Im reading this wrong, this functionality already exists. If the current tab's connection IsClosed() it sets that menu Items Visibility to Visibile. Otherwise its Collapsed. Maybe there is a bug?
Author
Owner

@jamespack commented on GitHub (May 26, 2025):

Image

@jamespack commented on GitHub (May 26, 2025): ![Image](https://github.com/user-attachments/assets/13ddc440-947c-42d2-8757-fb7570ab3ff7)
Author
Owner

@jamespack commented on GitHub (May 26, 2025):

Seems to work

Image

@jamespack commented on GitHub (May 26, 2025): Seems to work ![Image](https://github.com/user-attachments/assets/47502abb-878a-484b-82de-3f76166ac151)
Author
Owner

@vadimkantorov commented on GitHub (May 26, 2025):

I'm proposing to always make this menu item available. My usecase is that some program (like ssh) hangs the tab completely, and I'd like to be able forcibly restart the tab (basically kill the existing tab, and create a new tab with the same profile at the same place in the tab bar) - even if the Terminal does not detect the tab as "restartable"

"Restart connection" is also a super strange naming for this...

@vadimkantorov commented on GitHub (May 26, 2025): I'm proposing to always make this menu item available. My usecase is that some program (like ssh) hangs the tab completely, and I'd like to be able forcibly restart the tab (basically kill the existing tab, and create a new tab with the same profile at the same place in the tab bar) - even if the Terminal does not detect the tab as "restartable" "Restart connection" is also a super strange naming for this...
Author
Owner

@jamespack commented on GitHub (May 28, 2025):

@DHowett Whats your view on this?

@jamespack commented on GitHub (May 28, 2025): @DHowett Whats your view on this?
Author
Owner

@DHowett commented on GitHub (May 28, 2025):

Please do feel free to add it to the menu. However: it is a destructive action; should we guard it as such?

@DHowett commented on GitHub (May 28, 2025): Please do feel free to add it to the menu. However: it is a destructive action; should we guard it as such?
Author
Owner

@jamespack commented on GitHub (May 29, 2025):

Yea I feel like this is a different use case. This is a process that is hung either on the remote session or possibly on the client side. It could be tricky to know which. Further, it could become a slippery slope to start killing processes. Id be hesitant to add a menu item that whose intention was to kill processes that we couldnt be 100% sure we knew was the culprit for the hung tab. Thats just my two pennies worth.

@jamespack commented on GitHub (May 29, 2025): Yea I feel like this is a different use case. This is a process that is hung either on the remote session or possibly on the client side. It could be tricky to know which. Further, it could become a slippery slope to start killing processes. Id be hesitant to add a menu item that whose intention was to kill processes that we couldnt be 100% sure we knew was the culprit for the hung tab. Thats just my two pennies worth.
Author
Owner

@jamespack commented on GitHub (May 29, 2025):

I suppose at the end of the day if we know what process is responsible for the tab we can restart that process as the tab is useless at that point anyway.

@jamespack commented on GitHub (May 29, 2025): I suppose at the end of the day if we know what process is responsible for the tab we can restart that process as the tab is useless at that point anyway.
Author
Owner

@jamespack commented on GitHub (May 29, 2025):

Do we even do that kind of book keeping?

@jamespack commented on GitHub (May 29, 2025): Do we even do that kind of book keeping?
Author
Owner

@vadimkantorov commented on GitHub (May 29, 2025):

Well, there is already a "destructive" option to close the tab (and restart the tab when the user wishes so isn't much different) , so the bookkeeping should be somewhere...

@vadimkantorov commented on GitHub (May 29, 2025): Well, there is already a "destructive" option to close the tab (and restart the tab when the user wishes so isn't much different) , so the bookkeeping should be somewhere...
Author
Owner

@jamespack commented on GitHub (Jun 16, 2025):

Sure just destroying and re-creating the tab would be fairly trivial (I think). Btw there is a setting currently available to always create new tabs next to the current tab instead of at the end of the tab row which is the default. Not sure if you were aware of that or not. That would solve at least part of this.

@jamespack commented on GitHub (Jun 16, 2025): Sure just destroying and re-creating the tab would be fairly trivial (I think). Btw there is a setting currently available to always create new tabs next to the current tab instead of at the end of the tab row which is the default. Not sure if you were aware of that or not. That would solve at least part of this.
Author
Owner

@AdrianoCahete commented on GitHub (Jan 19, 2026):

What's happen when this tab has a lot of panels? All panels are restarted togheter?

@AdrianoCahete commented on GitHub (Jan 19, 2026): What's happen when this tab has a lot of panels? All panels are restarted togheter?
Author
Owner

@vadimkantorov commented on GitHub (Jan 20, 2026):

Maybe (if technically possible), or even if just a single panel appears - it's good.

This restart functionality is needed for force-restarting hung tabs (when the process ignores signals or is stuck in kernel wait - e.g. ssh connection being stuck, unstucking by itself can take minutes)

@vadimkantorov commented on GitHub (Jan 20, 2026): Maybe (if technically possible), or even if just a single panel appears - it's good. This restart functionality is needed for force-restarting hung tabs (when the process ignores signals or is stuck in kernel wait - e.g. ssh connection being stuck, unstucking by itself can take minutes)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23246