remote: Reuse the known OS when reconnecting over SSH (#65024)

## Summary

The OS should not be re-probed during remote reconnection.

## Testing

Just a simple refactoring.

## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [ ] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [ ] Tests cover the new or changed behavior.

Release Notes:

- Reuse the known OS when reconnecting over SSH

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
狐狸andKirill Bulatov authored and GitHub committed 2026-10-05 07:30:35 +00:00
1 parent ad4512a2e5
commit e4945b5d09
2 files changed
+14 -4

No files matched your search

+9 -3
View File
@@ -385,7 +385,7 @@ pub async fn connect(
) -> Result<Arc<dyn RemoteConnection>> {
cx.update(|cx| {
cx.update_default_global(|pool: &mut ConnectionPool, cx| {
pool.connect(connection_options.clone(), delegate.clone(), cx)
pool.connect(connection_options.clone(), None, delegate.clone(), cx)
})
})
.await
@@ -684,7 +684,12 @@ impl RemoteClient {
let (remote_connection, io_task) = match async {
let remote_connection = cx
.update_global(|pool: &mut ConnectionPool, cx| {
pool.connect(connection_options, delegate.clone(), cx)
pool.connect(
connection_options,
Some(remote_connection.remote_platform().os),
delegate.clone(),
cx,
)
})
.await
.map_err(|error| error.cloned())?;
@@ -1231,6 +1236,7 @@ impl ConnectionPool {
fn connect(
&mut self,
opts: RemoteConnectionOptions,
known_os: Option<RemoteOs>,
delegate: Arc<dyn RemoteClientDelegate>,
cx: &mut App,
) -> Shared<Task<Result<Arc<dyn RemoteConnection>, Arc<anyhow::Error>>>> {
@@ -1270,7 +1276,7 @@ impl ConnectionPool {
async move |cx| {
let connection = match opts.clone() {
RemoteConnectionOptions::Ssh(opts) => {
SshRemoteConnection::new(opts, delegate, cx)
SshRemoteConnection::new(opts, known_os, delegate, cx)
.await
.map(|connection| Arc::new(connection) as Arc<dyn RemoteConnection>)
}
+5 -1
View File
@@ -633,6 +633,7 @@ async fn find_existing_control_master(
impl SshRemoteConnection {
pub(crate) async fn new(
connection_options: SshConnectionOptions,
known_os: Option<RemoteOs>,
delegate: Arc<dyn RemoteClientDelegate>,
cx: &mut AsyncApp,
) -> Result<Self> {
@@ -788,7 +789,10 @@ impl SshRemoteConnection {
(socket, Some(master_process))
};
let is_windows = socket.probe_is_windows().await;
let is_windows = match known_os {
Some(os) => os.is_windows(),
None => socket.probe_is_windows().await,
};
log::info!("Remote is windows: {}", is_windows);
let ssh_shell = socket.shell(is_windows).await;