Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
codex: Delete older versions after installing new one (#41191)
Bennet Fenner06e1db54a753
diff --git a/crates/agent_servers/src/codex.rs b/crates/agent_servers/src/codex.rsindex 3b2b4171de8..1b287063e5d 100644--- a/crates/agent_servers/src/codex.rs+++ b/crates/agent_servers/src/codex.rs@@ -79,8 +79,6 @@ impl AgentServer for Codex {root_dir.as_deref(),extra_env,delegate.status_tx,- // For now, report that there are no updates.- // (A future PR will use the GitHub Releases API to fetch them.)delegate.new_version_available,&mut cx.to_async(),))diff --git a/crates/project/src/agent_server_store.rs b/crates/project/src/agent_server_store.rsindex 8a950d2820c..29060fa9448 100644--- a/crates/project/src/agent_server_store.rs+++ b/crates/project/src/agent_server_store.rs@@ -1212,7 +1212,7 @@ impl ExternalAgentServer for LocalCodex {&mut self,root_dir: Option<&str>,extra_env: HashMap<String, String>,- _status_tx: Option<watch::Sender<SharedString>>,+ status_tx: Option<watch::Sender<SharedString>>,_new_version_available_tx: Option<watch::Sender<Option<String>>>,cx: &mut AsyncApp,) -> Task<Result<(AgentServerCommand, String, Option<task::SpawnInTerminal>)>> {@@ -1261,6 +1261,10 @@ impl ExternalAgentServer for LocalCodex {let version_dir = dir.join(&release.tag_name);if !fs.is_dir(&version_dir).await {+ if let Some(mut status_tx) = status_tx {+ status_tx.send("Installing…".into()).ok();+ }+let tag = release.tag_name.clone();let version_number = tag.trim_start_matches('v');let asset_name = asset_name(version_number)@@ -1287,6 +1291,9 @@ impl ExternalAgentServer for LocalCodex {},).await?;++ // remove older versions+ util::fs::remove_matching(&dir, |entry| entry != version_dir).await;}let bin_name = if cfg!(windows) {