Skip to content

App update kills all terminal sessions — no session persistence across Sparkle restart #1984

@austinywang

Description

@austinywang

Summary

When cmux updates via Sparkle (auto-update or manual "Install Update"), the app quits and relaunches. All terminal sessions are destroyed in the process — running shells, background processes, SSH connections, and AI agents (Claude, Codex) are all killed. The update behaves like fully quitting the app and opening it fresh.

This is a major disruption for power users who may have dozens of workspaces with long-running processes. A single update wipes out all active work.

Expected behavior

Terminal sessions should survive app updates. Options include:

  1. Session persistence across restart — serialize pty file descriptors and restore them after relaunch (like tmux/screen session detach/reattach)
  2. Process preservation via fd passing — hand off pty FDs to a helper daemon before quit, then reclaim them on relaunch
  3. Sparkle in-place update without restart — update the binary on disk but keep the running process alive (only restart on next manual quit)
  4. At minimum: warn before updating — if sessions are active, show a confirmation dialog listing what will be lost ("12 workspaces with active processes will be terminated")

Current behavior

  • Sparkle triggers app quit → relaunch
  • All ptys are closed, sending SIGHUP to all child processes
  • Shells, SSH sessions, running commands, and AI agents are all killed
  • On relaunch, workspaces are recreated but with fresh empty shells
  • No warning is shown about active sessions being destroyed

Suggested approach

The most robust solution is a session daemon (similar to how VS Code's terminal works, or tmux's server):

  1. A lightweight cmuxd helper process owns the pty file descriptors
  2. The GUI app connects to cmuxd to display terminal output
  3. On update/restart, cmuxd keeps running — ptys stay alive
  4. On relaunch, the GUI reconnects to cmuxd and reattaches to existing sessions

A simpler intermediate fix would be to at least warn the user before an update kills active sessions, and let them defer the update.

Impact

  • Every update kills all running agents and terminal sessions
  • Users lose unsaved work, SSH connections, long-running builds
  • Discourages updating, leading to users running stale versions

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions