diff --git a/desktop/src-tauri/src/managed_agents/restore.rs b/desktop/src-tauri/src/managed_agents/restore.rs index 3b093e444..9a99ff803 100644 --- a/desktop/src-tauri/src/managed_agents/restore.rs +++ b/desktop/src-tauri/src/managed_agents/restore.rs @@ -129,7 +129,11 @@ pub async fn restore_managed_agents_on_launch( (canonical == receipt.key && receipt.desktop_instance_id == super::current_instance_id(app) && super::process_is_running(receipt.pid) - && super::process_belongs_to_us(receipt.pid)) + && super::process_belongs_to_us(receipt.pid) + && super::process_has_buzz_marker( + receipt.pid, + &receipt.desktop_instance_id, + )) .then_some(receipt.pid) }), ) diff --git a/desktop/src-tauri/src/managed_agents/runtime.rs b/desktop/src-tauri/src/managed_agents/runtime.rs index 832fe0041..0c9ab95b6 100644 --- a/desktop/src-tauri/src/managed_agents/runtime.rs +++ b/desktop/src-tauri/src/managed_agents/runtime.rs @@ -169,7 +169,7 @@ fn buzz_marker_entry(instance_id: &str) -> Vec { /// is this desktop instance's id. A process stamped with a *different* instance /// id belongs to another live Buzz app and must never be reaped here. #[cfg(target_os = "macos")] -fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { +pub(crate) fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { let marker = buzz_marker_entry(instance_id); let Some(buf) = sweep::procargs2_buffer(pid) else { return false; @@ -213,7 +213,7 @@ fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { } #[cfg(all(unix, not(target_os = "macos")))] -fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { +pub(crate) fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { let marker = buzz_marker_entry(instance_id); let Ok(data) = std::fs::read(format!("/proc/{pid}/environ")) else { return false; @@ -222,7 +222,7 @@ fn process_has_buzz_marker(pid: u32, instance_id: &str) -> bool { } #[cfg(not(unix))] -fn process_has_buzz_marker(_pid: u32, _instance_id: &str) -> bool { +pub(crate) fn process_has_buzz_marker(_pid: u32, _instance_id: &str) -> bool { false }