Preserve SSH connection settings when opening new windows

Forward the invoking shell's remote executable and agent through the Linux prefork launcher. Resolve mounted tabs by stable ID for the New Window shortcut and reconnect to nested destinations from the local host.
This commit is contained in:
James Magahern
2026-11-17 16:20:54 -08:00
parent 153838061e
commit cc2acb51e4
9 changed files with 408 additions and 125 deletions
+27 -1
View File
@@ -33,13 +33,29 @@ pub enum SessionTarget {
Remembered(SessionIdentity),
}
/// SSH settings inherited from the shell that requested a remote tab.
/// SSH settings inherited from the shell that requested a remote session.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SshOptions {
pub executable: Option<String>,
pub agent_socket: Option<std::path::PathBuf>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RemoteWindow {
pub destination: String,
pub ssh: SshOptions,
}
impl RemoteWindow {
/// Older launch requests carry only the host and inherit the launcher's settings.
pub fn from_env(destination: String) -> Self {
Self {
destination,
ssh: SshOptions::from_env(),
}
}
}
/// Reconnect using the original remote binary and verify the daemon that owned the shell.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct DetachedRemote {
@@ -162,6 +178,16 @@ pub enum ClientMessage {
origin: Option<SessionIdentity>,
},
RememberDetachedRemote(DetachedRemote),
OpenRemoteWindow {
target: RemoteWindow,
session: SessionTarget,
},
/// Resolve a mounted connection on the user's joined local workspace.
OpenWindowForRemoteTab {
tab: TabId,
cwd: Option<String>,
fallback: SshOptions,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]