From 564ded71c144f441700323bfa3043390206421fe Mon Sep 17 00:00:00 2001 From: Cole Miller Date: Tue, 2 Sep 2025 19:29:21 -0400 Subject: [PATCH] acp: Disable external agents over SSH (#37402) Follow-up to #37377 Show a clearer error here until SSH support is implemented. Release Notes: - N/A --- Cargo.toml | 2 +- crates/agent_ui/src/acp/thread_view.rs | 4 +--- crates/agent_ui/src/agent_panel.rs | 16 +++++++--------- crates/git_ui/src/branch_picker.rs | 1 - crates/vim/src/visual.rs | 1 - 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 90b01945f71264eb367239809c9811034a71f2d9..08551ef75a315563f9cdb22c0ed92742d550df61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -847,7 +847,7 @@ too_many_arguments = "allow" large_enum_variant = "allow" # Boolean expressions can be hard to read, requiring only the minimal form gets in the way -nonminimal_bol = "allow" +nonminimal_bool = "allow" [workspace.metadata.cargo-machete] ignored = [ diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index 357a8543712eec5ea0723c4f36f05e4d6d5c0b9d..dc8abd99ae9e9afb07a5e3360e1216a07a528d01 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -420,9 +420,7 @@ impl AcpThreadView { window: &mut Window, cx: &mut Context, ) -> ThreadState { - if project.read(cx).is_via_collab() - && agent.clone().downcast::().is_none() - { + if !project.read(cx).is_local() && agent.clone().downcast::().is_none() { return ThreadState::LoadError(LoadError::Other( "External agents are not yet supported for remote projects.".into(), )); diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 3da63c281ef72765479d23cc508ef4ca50ff927c..2383963d6c26c6afea1b03d7f28b29bf3a9b4223 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -1091,7 +1091,7 @@ impl AgentPanel { let workspace = self.workspace.clone(); let project = self.project.clone(); let fs = self.fs.clone(); - let is_via_collab = self.project.read(cx).is_via_collab(); + let is_not_local = !self.project.read(cx).is_local(); const LAST_USED_EXTERNAL_AGENT_KEY: &str = "agent_panel__last_used_external_agent"; @@ -1123,7 +1123,7 @@ impl AgentPanel { agent } None => { - if is_via_collab { + if is_not_local { ExternalAgent::NativeAgent } else { cx.background_spawn(async move { @@ -2532,10 +2532,8 @@ impl AgentPanel { .with_handle(self.new_thread_menu_handle.clone()) .menu({ let workspace = self.workspace.clone(); - let is_via_collab = workspace - .update(cx, |workspace, cx| { - workspace.project().read(cx).is_via_collab() - }) + let is_not_local = workspace + .update(cx, |workspace, cx| !workspace.project().read(cx).is_local()) .unwrap_or_default(); move |window, cx| { @@ -2627,7 +2625,7 @@ impl AgentPanel { ContextMenuEntry::new("New Gemini CLI Thread") .icon(IconName::AiGemini) .icon_color(Color::Muted) - .disabled(is_via_collab) + .disabled(is_not_local) .handler({ let workspace = workspace.clone(); move |window, cx| { @@ -2654,7 +2652,7 @@ impl AgentPanel { menu.item( ContextMenuEntry::new("New Claude Code Thread") .icon(IconName::AiClaude) - .disabled(is_via_collab) + .disabled(is_not_local) .icon_color(Color::Muted) .handler({ let workspace = workspace.clone(); @@ -2687,7 +2685,7 @@ impl AgentPanel { ContextMenuEntry::new(format!("New {} Thread", agent_name)) .icon(IconName::Terminal) .icon_color(Color::Muted) - .disabled(is_via_collab) + .disabled(is_not_local) .handler({ let workspace = workspace.clone(); let agent_name = agent_name.clone(); diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs index fb56cdcc5def31765d26545fcfa79b5f8c44e884..2b5a543e932aeed0ca0f00e2596e7fa79a35fb9a 100644 --- a/crates/git_ui/src/branch_picker.rs +++ b/crates/git_ui/src/branch_picker.rs @@ -341,7 +341,6 @@ impl PickerDelegate for BranchListDelegate { }; picker .update(cx, |picker, _| { - #[allow(clippy::nonminimal_bool)] if !query.is_empty() && !matches .first() diff --git a/crates/vim/src/visual.rs b/crates/vim/src/visual.rs index fcce00f0c0ffee43f1b7980fcf9fe3a70f6e7794..c62712af311eb09f1203ecb54d939402f936b21c 100644 --- a/crates/vim/src/visual.rs +++ b/crates/vim/src/visual.rs @@ -216,7 +216,6 @@ impl Vim { // If the file ends with a newline (which is common) we don't do this. // so that if you go to the end of such a file you can use "up" to go // to the previous line and have it work somewhat as expected. - #[allow(clippy::nonminimal_bool)] if !selection.reversed && !selection.is_empty() && !(selection.end.column() == 0 && selection.end == map.max_point())