Expand description
Durable SSH terminals (P4 of SPEC_REMOTE_TERMINALS_AND_DURABLE_SESSIONS_2026_10_02.md, §7).
A pane on an SSH connection with term:durable set is not a local PTY. It
runs ssh -T host -- agentmux-remote attach --session ID --offset N ...
and speaks the helper’s frames (agentmux_remote::frame) over that
channel: the shell itself lives in the helper’s daemon on the host, so a
dropped link, a sleeping laptop or an AgentMux restart only drops this
ssh, and the pane reattaches and gets exactly what it missed.
- Output lands in the pane’s
termfile through the same append as a PTY’s (shell::handle_append_block_file), and the next remote offset is kept beside it in that file’s metadata (remote:offset), written right after each append, so a reattach asks for exactly what is missing. - The session id is the block’s
remote:session_id, made on first start. - The status stays
runningwhile reconnecting; only the session’s own end (Exited) makes itdone, which is what offers “press to restart”. - Reconnect never gives up while the pane is open (§7.4): backoff 1, 2, 5,
10, then every 30 s. A ping every 15 s, and an
sshsilent for 35 s is killed and replaced rather than left to its own timeout (§7.5). - Closing the pane ends the session; quitting AgentMux detaches it (it keeps running on the host for the next start to reattach); a forced restart or a connection change detaches too.
sshhas no terminal here, so its prompts (a password, a passphrase, a new host key) go to the user through the askpass bridge (remote::askpass). A login it still cannot make stops the pane with the reason rather than asking again every 30 s.
Structs§
Enums§
- Accept
- What part of an
Outputframe the pane has not seen yet, given the next offset it expects.
Constants§
- FILE_
META_ REMOTE_ OFFSET termfile meta: the next offset of the remote session’s output.- META_
KEY_ DURABLE - Block meta: turns a pane on an SSH connection into a durable one.
- META_
KEY_ SESSION_ ID - Block meta: the helper session this pane attaches to.
Functions§
- accept
- Decide what to do with output at
offset, when the pane expectsexpected. - attach_
command - The command
sshruns on the host. - backoff
- How long to wait before reconnect attempt
attempt(0-based): 1, 2, 5, 10, then 30 s for ever. Never a last attempt: a cap is how a recoverable pane becomes a dead one. - helper_
path - Where the helper is installed on the host: a versioned path, so two
AgentMux versions can use one host (spec §6.2).
~is the remote home. - login_
refused - ssh could not log in, and trying again would only fail (or ask) again: refused credentials, or a host key it will not accept.
- note_
app_ exiting - AgentMux is quitting (
sagas::agent_teardown::app_exit). - valid_
session_ id - A session id as the helper accepts it: letters, digits,
-and_, up to 64 (agentmux-remote’sdaemon::valid_session_id). - windows_
shell_ refused - The host’s shell is Windows’ (
cmdor PowerShell), which can’t run the helper: it answered the attach command that it doesn’t know it.
Type Aliases§
- Fallback
- Restarts a pane through
resync_controller, which then picks the plain shell controller becausewantshas turned false. Built byresync_controlleritself, which holds everything a restart needs. False when it did not restart: the pane would still be durable (so a restart would only come back here), or the block is gone.