From 012f4c2304e6e1a5b6521ef2103f86f3bf31b013 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Wed, 7 May 2025 09:02:50 +0300 Subject: [PATCH] Avoid panic when opening thread as markdown in non-local project (cherry-pick #30061) (#30062) Cherry-picked Avoid panic when opening thread as markdown in non-local project (#30061) Right now `agent: open active thread as markdown` will always panic when you try to use it over collab or when SSH remoting. This PR makes it log an error instead (we should follow up by restoring full remote support). Release Notes: - Prevented `agent: open active thread as markdown` from panicking when used in a non-local project. Co-authored-by: Cole Miller --- crates/agent/src/active_thread.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/agent/src/active_thread.rs b/crates/agent/src/active_thread.rs index 39061f57f3a07ac9b5bf279a1e6cd16540b25031..1f0584da7b5cd7bdeecd3cf06f5075ac2b20322b 100644 --- a/crates/agent/src/active_thread.rs +++ b/crates/agent/src/active_thread.rs @@ -3466,6 +3466,11 @@ pub(crate) fn open_active_thread_as_markdown( .unwrap_or_else(|| "Thread".to_string()); let project = workspace.project().clone(); + + if !project.read(cx).is_local() { + anyhow::bail!("failed to open active thread as markdown in remote project"); + } + let buffer = project.update(cx, |project, cx| { project.create_local_buffer(&markdown, Some(markdown_language), cx) });