diff --git a/Cargo.lock b/Cargo.lock index 14ec0e21db3a1893002c6277c43b9d1b996ab086..2b01b45f637dd2e51802b91cec62f05b2f3f55fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -416,7 +416,6 @@ dependencies = [ "serde_json", "serde_json_lenient", "settings", - "shlex", "smol", "streaming_diff", "task", diff --git a/crates/agent_ui/Cargo.toml b/crates/agent_ui/Cargo.toml index 028db95c10a8c7a319bb05927dcabd0564a14683..47d9f6d6a27a2ad5102e831094912208e66a9b43 100644 --- a/crates/agent_ui/Cargo.toml +++ b/crates/agent_ui/Cargo.toml @@ -80,7 +80,6 @@ serde.workspace = true serde_json.workspace = true serde_json_lenient.workspace = true settings.workspace = true -shlex.workspace = true smol.workspace = true streaming_diff.workspace = true task.workspace = true diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index d3986155d741393a01bce829a886aba4ee497948..ceed3f8f98fbf95f5b4278d8354e30e90299b18d 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -9,7 +9,7 @@ use agent_client_protocol::{self as acp, PromptCapabilities}; use agent_servers::{AgentServer, AgentServerDelegate}; use agent_settings::{AgentProfileId, AgentSettings, CompletionMode, NotifyWhenAgentWaiting}; use agent2::{DbThreadMetadata, HistoryEntry, HistoryEntryId, HistoryStore, NativeAgentServer}; -use anyhow::{Context as _, Result, anyhow, bail}; +use anyhow::{Result, anyhow, bail}; use arrayvec::ArrayVec; use audio::{Audio, Sound}; use buffer_diff::BufferDiff; @@ -1584,19 +1584,6 @@ impl AcpThreadView { window.spawn(cx, async move |cx| { let mut task = login.clone(); - task.command = task - .command - .map(|command| anyhow::Ok(shlex::try_quote(&command)?.to_string())) - .transpose()?; - task.args = task - .args - .iter() - .map(|arg| { - Ok(shlex::try_quote(arg) - .context("Failed to quote argument")? - .to_string()) - }) - .collect::>>()?; task.full_label = task.label.clone(); task.id = task::TaskId(format!("external-agent-{}-login", task.label)); task.command_label = task.label.clone(); @@ -5680,6 +5667,23 @@ pub(crate) mod tests { }); } + #[gpui::test] + async fn test_spawn_external_agent_login_handles_spaces(cx: &mut TestAppContext) { + init_test(cx); + + // Verify paths with spaces aren't pre-quoted + let path_with_spaces = "/Users/test/Library/Application Support/Zed/cli.js"; + let login_task = task::SpawnInTerminal { + command: Some("node".to_string()), + args: vec![path_with_spaces.to_string(), "/login".to_string()], + ..Default::default() + }; + + // Args should be passed as-is, not pre-quoted + assert!(!login_task.args[0].starts_with('"')); + assert!(!login_task.args[0].starts_with('\'')); + } + #[gpui::test] async fn test_notification_for_tool_authorization(cx: &mut TestAppContext) { init_test(cx);