From 61efb805e7eb0cbb96b53b3cc74626e07735f831 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 21:03:10 +0000 Subject: [PATCH 1/2] Clarify SSH extension timeout copy Co-authored-by: aloke --- crates/remote_server/src/transport.rs | 45 +++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/crates/remote_server/src/transport.rs b/crates/remote_server/src/transport.rs index c3e9ce9a12..2f93426641 100644 --- a/crates/remote_server/src/transport.rs +++ b/crates/remote_server/src/transport.rs @@ -111,11 +111,20 @@ impl Error { /// SSH remote-server failed banner, using `stage` to provide /// context-appropriate copy. pub fn user_facing_error(&self, stage: SetupStage) -> UserFacingError { + if matches!(self, Self::TimedOut) { + return UserFacingError { + body: format!("Timed out while trying to {}", stage.action_description()), + detail: Some( + "Warp stopped waiting for the SSH extension to respond. Your SSH session is \ + still running, but advanced features are unavailable for now." + .into(), + ), + }; + } + let body = format!("Failed to {}", stage.action_description()); let detail = match self { - Self::TimedOut => { - Some("The operation timed out — check your network connection".into()) - } + Self::TimedOut => unreachable!("handled above"), Self::UnsupportedOs { os } => Some(format!("Unsupported OS: {os}")), Self::UnsupportedArch { arch } => Some(format!("Unsupported architecture: {arch}")), Self::ScriptFailed { exit_code, stderr } => { @@ -137,6 +146,36 @@ impl Error { } } +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn timed_out_error_copy_leads_with_timeout() { + let error = Error::TimedOut.user_facing_error(SetupStage::Launch); + + assert_eq!(error.body, "Timed out while trying to start SSH extension"); + assert_eq!( + error.detail.as_deref(), + Some( + "Warp stopped waiting for the SSH extension to respond. Your SSH session is \ + still running, but advanced features are unavailable for now." + ) + ); + } + + #[test] + fn non_timeout_error_copy_still_leads_with_failure() { + let error = Error::UnsupportedOs { + os: "plan9".to_string(), + } + .user_facing_error(SetupStage::CheckBinary); + + assert_eq!(error.body, "Failed to verify SSH extension"); + assert_eq!(error.detail.as_deref(), Some("Unsupported OS: plan9")); + } +} + /// A successful return from [`RemoteTransport::connect`]. /// /// Bundles the live [`RemoteServerClient`] and its [`ClientEvent`] From 8699ecbddd4341b66e23c8d621d6bafabfb9fb2a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 17 May 2026 21:44:04 +0000 Subject: [PATCH 2/2] Move SSH timeout copy tests Co-authored-by: aloke --- crates/remote_server/src/transport.rs | 34 +++------------------ crates/remote_server/src/transport_tests.rs | 26 ++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 crates/remote_server/src/transport_tests.rs diff --git a/crates/remote_server/src/transport.rs b/crates/remote_server/src/transport.rs index 2f93426641..7b275b0b38 100644 --- a/crates/remote_server/src/transport.rs +++ b/crates/remote_server/src/transport.rs @@ -146,36 +146,6 @@ impl Error { } } -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn timed_out_error_copy_leads_with_timeout() { - let error = Error::TimedOut.user_facing_error(SetupStage::Launch); - - assert_eq!(error.body, "Timed out while trying to start SSH extension"); - assert_eq!( - error.detail.as_deref(), - Some( - "Warp stopped waiting for the SSH extension to respond. Your SSH session is \ - still running, but advanced features are unavailable for now." - ) - ); - } - - #[test] - fn non_timeout_error_copy_still_leads_with_failure() { - let error = Error::UnsupportedOs { - os: "plan9".to_string(), - } - .user_facing_error(SetupStage::CheckBinary); - - assert_eq!(error.body, "Failed to verify SSH extension"); - assert_eq!(error.detail.as_deref(), Some("Unsupported OS: plan9")); - } -} - /// A successful return from [`RemoteTransport::connect`]. /// /// Bundles the live [`RemoteServerClient`] and its [`ClientEvent`] @@ -318,3 +288,7 @@ pub trait RemoteTransport: Send + Sync + std::fmt::Debug { /// the reconnect loop entirely. fn is_reconnectable(&self, exit_status: Option<&RemoteServerExitStatus>) -> bool; } + +#[cfg(test)] +#[path = "transport_tests.rs"] +mod tests; diff --git a/crates/remote_server/src/transport_tests.rs b/crates/remote_server/src/transport_tests.rs new file mode 100644 index 0000000000..6944450b4d --- /dev/null +++ b/crates/remote_server/src/transport_tests.rs @@ -0,0 +1,26 @@ +use super::*; + +#[test] +fn timed_out_error_copy_leads_with_timeout() { + let error = Error::TimedOut.user_facing_error(SetupStage::Launch); + + assert_eq!(error.body, "Timed out while trying to start SSH extension"); + assert_eq!( + error.detail.as_deref(), + Some( + "Warp stopped waiting for the SSH extension to respond. Your SSH session is \ + still running, but advanced features are unavailable for now." + ) + ); +} + +#[test] +fn non_timeout_error_copy_still_leads_with_failure() { + let error = Error::UnsupportedOs { + os: "plan9".to_string(), + } + .user_facing_error(SetupStage::CheckBinary); + + assert_eq!(error.body, "Failed to verify SSH extension"); + assert_eq!(error.detail.as_deref(), Some("Unsupported OS: plan9")); +}