[PR #10170] [MERGED] [Defapp] Use real HPCON for PTY management; Have Monarch always listen for connections #27939

Open
opened 2026-01-31 09:25:16 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/10170
Author: @miniksa
Created: 5/24/2021
Status: ✅ Merged
Merged: 5/24/2021
Merged by: @undefined

Base: main ← Head: dev/miniksa/defapp_fix


📝 Commits (10+)

  • 87ac76f Fix sizing issue with version number on drop down.
  • 812a97f Add server process and client reference handle to ITerminalHandoff so we could make a true HPCON on the receiving side. Reguid interface for ITerminalHandoff. Make HPCON packer and pack it on inbound connection.
  • 2090584 This makes the monarch always be an inbound listener for console connections.
  • 464ebb8 attempt force to foreground
  • 70d0118 make sure no one can surprise us on closing this client handle
  • 4926dcb Revert "attempt force to foreground"
  • 6fbf822 Revert "make sure no one can surprise us on closing this client handle"
  • df7f36b fix spelling, remove psuedoconsole misspelling from expect.txt, add cce to alphabet.txt
  • f53ec81 CODE FORMAT!!!!
  • 87c606f fix typo in samples

📊 Changes

24 files changed (+143 additions, -35 deletions)

View changed files

📝 .github/actions/spelling/expect/alphabet.txt (+1 -0)
📝 .github/actions/spelling/expect/expect.txt (+0 -1)
📝 samples/ConPTY/GUIConsole/GUIConsole.ConPTY/Terminal.cs (+1 -1)
📝 samples/ConPTY/MiniTerm/MiniTerm/Terminal.cs (+1 -1)
📝 src/cascadia/CascadiaPackage/Package-Dev.appxmanifest (+1 -1)
📝 src/cascadia/CascadiaPackage/Package-Pre.appxmanifest (+1 -1)
📝 src/cascadia/CascadiaPackage/Package.appxmanifest (+1 -1)
📝 src/cascadia/TerminalApp/AppLogic.cpp (+13 -1)
📝 src/cascadia/TerminalApp/AppLogic.h (+2 -0)
📝 src/cascadia/TerminalApp/AppLogic.idl (+2 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+37 -15)
📝 src/cascadia/TerminalApp/TerminalPage.h (+2 -0)
📝 src/cascadia/TerminalConnection/CTerminalHandoff.cpp (+8 -4)
📝 src/cascadia/TerminalConnection/CTerminalHandoff.h (+4 -2)
📝 src/cascadia/TerminalConnection/ConptyConnection.cpp (+5 -3)
📝 src/cascadia/TerminalConnection/ConptyConnection.h (+3 -1)
📝 src/cascadia/TerminalControl/TermControl.cpp (+4 -1)
📝 src/cascadia/TerminalSettingsEditor/Launch.xaml (+1 -1)
📝 src/cascadia/WindowsTerminal/AppHost.cpp (+8 -0)
📝 src/cascadia/WindowsTerminal/AppHost.h (+1 -0)

...and 4 more files

📄 Description

[Defapp] Use real HPCON for PTY management; Have Monarch always listen for connections

PR Checklist

Detailed Description of the Pull Request / Additional comments

  • Sometimes peasants can't manage to accept a connection appropriately because I wrote defterm before @zadjii-msft's monarch/peasant architecture. The simple solution here is to just make the monarch always be listening for inbound connections. Then COM won't start a peasant with -Embedding just to ask the monarch where it should go. It'll just join the active window. I didn't close 9475 because it should follow monarch policies on which window to join... and it doesn't yet.
  • A lot of interesting things are happening because this didn't have a real HPCON. So I passed through the remaining handles (and re-GUID-ed the interface) that made it possible for me to pack the right process handles and such into an HPCON on the inbound connection and monitor that like any other ConptyConnection. This should resolve some of the process exit behaviors and signal channel things like resizing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/10170 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 5/24/2021 **Status:** ✅ Merged **Merged:** 5/24/2021 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/miniksa/defapp_fix` --- ### 📝 Commits (10+) - [`87ac76f`](https://github.com/microsoft/terminal/commit/87ac76f4961716c14137de6d0a4cd203bc9e0ead) Fix sizing issue with version number on drop down. - [`812a97f`](https://github.com/microsoft/terminal/commit/812a97f12961a4baf9cd45766116643f4879f892) Add server process and client reference handle to ITerminalHandoff so we could make a true HPCON on the receiving side. Reguid interface for ITerminalHandoff. Make HPCON packer and pack it on inbound connection. - [`2090584`](https://github.com/microsoft/terminal/commit/2090584f0232645087bfa1bfd370c267eae20d7a) This makes the monarch always be an inbound listener for console connections. - [`464ebb8`](https://github.com/microsoft/terminal/commit/464ebb8d8ab2d922b356505dfddaf1569c987a39) attempt force to foreground - [`70d0118`](https://github.com/microsoft/terminal/commit/70d011828681b72d3798599c8254398564f63b00) make sure no one can surprise us on closing this client handle - [`4926dcb`](https://github.com/microsoft/terminal/commit/4926dcb1ca4570e9da5640559ee87f72ab365e8f) Revert "attempt force to foreground" - [`6fbf822`](https://github.com/microsoft/terminal/commit/6fbf822dabb3931d13a8c0eef7496c2426bd04b7) Revert "make sure no one can surprise us on closing this client handle" - [`df7f36b`](https://github.com/microsoft/terminal/commit/df7f36b037d254446434f220658be7ae1fcba753) fix spelling, remove psuedoconsole misspelling from expect.txt, add cce to alphabet.txt - [`f53ec81`](https://github.com/microsoft/terminal/commit/f53ec813257450e00018972f1c2e5fe092e4284c) CODE FORMAT!!!! - [`87c606f`](https://github.com/microsoft/terminal/commit/87c606f9437b1a76393171cea5f3a3cadff3d6bc) fix typo in samples ### 📊 Changes **24 files changed** (+143 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `.github/actions/spelling/expect/alphabet.txt` (+1 -0) 📝 `.github/actions/spelling/expect/expect.txt` (+0 -1) 📝 `samples/ConPTY/GUIConsole/GUIConsole.ConPTY/Terminal.cs` (+1 -1) 📝 `samples/ConPTY/MiniTerm/MiniTerm/Terminal.cs` (+1 -1) 📝 `src/cascadia/CascadiaPackage/Package-Dev.appxmanifest` (+1 -1) 📝 `src/cascadia/CascadiaPackage/Package-Pre.appxmanifest` (+1 -1) 📝 `src/cascadia/CascadiaPackage/Package.appxmanifest` (+1 -1) 📝 `src/cascadia/TerminalApp/AppLogic.cpp` (+13 -1) 📝 `src/cascadia/TerminalApp/AppLogic.h` (+2 -0) 📝 `src/cascadia/TerminalApp/AppLogic.idl` (+2 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+37 -15) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+2 -0) 📝 `src/cascadia/TerminalConnection/CTerminalHandoff.cpp` (+8 -4) 📝 `src/cascadia/TerminalConnection/CTerminalHandoff.h` (+4 -2) 📝 `src/cascadia/TerminalConnection/ConptyConnection.cpp` (+5 -3) 📝 `src/cascadia/TerminalConnection/ConptyConnection.h` (+3 -1) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+4 -1) 📝 `src/cascadia/TerminalSettingsEditor/Launch.xaml` (+1 -1) 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+8 -0) 📝 `src/cascadia/WindowsTerminal/AppHost.h` (+1 -0) _...and 4 more files_ </details> ### 📄 Description [Defapp] Use real HPCON for PTY management; Have Monarch always listen for connections ## PR Checklist * [x] Closes #9464 * [x] Related to #9475 - incomplete fix * [x] I work here. * [x] Manual test ## Detailed Description of the Pull Request / Additional comments - Sometimes peasants can't manage to accept a connection appropriately because I wrote defterm before @zadjii-msft's monarch/peasant architecture. The simple solution here is to just make the monarch always be listening for inbound connections. Then COM won't start a peasant with -Embedding just to ask the monarch where it should go. It'll just join the active window. I didn't close 9475 because it should follow monarch policies on which window to join... and it doesn't yet. - A lot of interesting things are happening because this didn't have a real HPCON. So I passed through the remaining handles (and re-GUID-ed the interface) that made it possible for me to pack the right process handles and such into an HPCON on the inbound connection and monitor that like any other ConptyConnection. This should resolve some of the process exit behaviors and signal channel things like resizing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:25:16 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27939