Skip to content

feat(tmux): add opt-in user-scope tmux launch#467

Open
johnrichardrinehart wants to merge 1 commit intoasheshgoplani:mainfrom
johnrichardrinehart:feat/tmux-user-scope-optin
Open

feat(tmux): add opt-in user-scope tmux launch#467
johnrichardrinehart wants to merge 1 commit intoasheshgoplani:mainfrom
johnrichardrinehart:feat/tmux-user-scope-optin

Conversation

@johnrichardrinehart
Copy link
Copy Markdown
Contributor

@johnrichardrinehart johnrichardrinehart commented Mar 30, 2026

TL;DR: If agent-deck is spawned using an SSH session, then there's a good chance that if the SSH connection is torn down that agent-deck's tmux session will be destroyed. This PR develops an (untested) opt-in configuration knob that allows users to spawn agent-deck in the user scope instead of a session scope (assuming systemd) in order that their agent-deck environment may hopefully survive things like SSH disconnects.

Description

Add a tmux config knob so session startup can launch the tmux server outside the caller's session-*.scope. When [tmux] launch_in_user_scope = true is set, agent-deck starts tmux through systemd-run --user --scope instead of invoking tmux directly.

This is intended for setups where agent-deck is started from SSH, a display-manager login, or another short-lived login scope. In those cases the tmux server can end up cgrouped under the login session that created it, so tearing down that session kills tmux and agent-deck later treats the session as missing and restarts it.

Launching tmux under the user manager keeps the server out of the transient session scope while keeping the behavior opt-in for users who do not want the extra systemd dependency.

Caveat

This only affects tmux servers created after the setting is enabled. Agent-deck still talks to tmux through the default socket, so an already-running default tmux server is not migrated by a later launch with this knob turned on. In mixed local/SSH usage, whichever context creates the tmux server first determines where that server lives until it is restarted.

Add a tmux config knob so session startup can launch the tmux server outside the caller's session-*.scope. When [tmux] launch_in_user_scope = true is set, agent-deck starts tmux through systemd-run --user --scope instead of invoking tmux directly.

This is intended for setups where agent-deck is started from SSH, a display-manager login, or another short-lived login scope. In those cases the tmux server can end up cgrouped under the login session that created it, so tearing down that session kills tmux and agent-deck later treats the session as missing and restarts it.

Launching tmux under the user manager keeps the server out of the transient session scope while keeping the behavior opt-in for users who do not want the extra systemd dependency.

This only affects tmux servers created after the setting is enabled. Agent-deck still talks to tmux through the default socket, so an already-running default tmux server is not migrated by a later launch with this knob turned on. In mixed local/SSH usage, whichever context creates the tmux server first determines where that server lives until it is restarted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant