feat(ui): confirm main-window close when Mission Control sessions are open

Closing the main window used to silently kill every open Mission Control
ConPTY session (App's ShutdownMode.OnMainWindowClose tears the process down
without warning). Intercept Window.Closing, and when at least one pane is
open, ask via the existing ConfirmAsync pattern before proceeding; cancelling
leaves the window and sessions alive, confirming force-closes as before.
This commit is contained in:
mika kuns
2026-08-21 18:14:48 +02:00
parent 89d30d1463
commit 0892883a82
5 changed files with 65 additions and 0 deletions
@@ -520,6 +520,16 @@ public sealed partial class IslandsShellViewModel : ViewModelBase, IDisposable
Dialogs.ShowMissionControl(MissionControl);
}
/// <summary>Number of Mission Control ConPTY panes currently open — the main window's
/// close guard asks for confirmation whenever this is greater than zero.</summary>
public int OpenMissionControlSessionCount => MissionControl?.ConPtySessions.Count ?? 0;
// Pure decision extracted for testability — closing the main window kills every open
// Mission Control pane's `claude` process (ConPtyPaneViewModel.Dispose), so ask first
// rather than let it happen silently.
internal static bool RequiresCloseConfirmation(int openMissionControlSessionCount) =>
openMissionControlSessionCount > 0;
private void SyncInteractiveSessionChips()
{
if (MissionControl is null || Tasks is null) return;