From aaf4be8490a18755687d6394ede20fd12e356b65 Mon Sep 17 00:00:00 2001 From: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz> Date: Mon, 10 Aug 2026 19:38:03 -0400 Subject: [PATCH] fix(desktop): clear local mode push checks Signed-off-by: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz> --- desktop/src-tauri/src/commands/agent_auth.rs | 45 ++++++++++++++++++++ desktop/src-tauri/src/commands/agents.rs | 40 ----------------- desktop/src-tauri/src/commands/workspace.rs | 2 +- desktop/src-tauri/src/local_relay.rs | 8 ++-- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/desktop/src-tauri/src/commands/agent_auth.rs b/desktop/src-tauri/src/commands/agent_auth.rs index bba0f33860..d90c9ad7f6 100644 --- a/desktop/src-tauri/src/commands/agent_auth.rs +++ b/desktop/src-tauri/src/commands/agent_auth.rs @@ -13,6 +13,51 @@ use serde::{Deserialize, Serialize}; use crate::managed_agents::{ default_agent_workdir, known_acp_runtime_exact, normalize_agent_args, resolve_command, }; +use crate::{ + app_state::AppState, + managed_agents::{load_managed_agents, save_managed_agents}, + util::now_iso, +}; + +pub(super) fn backfill_missing_agent_auth_tags( + app: &tauri::AppHandle, + state: &AppState, +) -> Result { + let owner_keys = state.signing_keys()?; + let compat_owner = nostr::Keys::parse(&owner_keys.secret_key().to_secret_hex()) + .map_err(|e| format!("failed to bridge owner keys: {e}"))?; + let _store_guard = state + .managed_agents_store_lock + .lock() + .map_err(|e| e.to_string())?; + let mut records = load_managed_agents(app)?; + let mut changed = 0; + for record in &mut records { + if record.auth_tag.is_some() + || record + .pubkey + .eq_ignore_ascii_case(&owner_keys.public_key().to_hex()) + { + continue; + } + let agent = nostr::PublicKey::from_hex(&record.pubkey) + .map_err(|e| format!("invalid managed agent pubkey {}: {e}", record.pubkey))?; + record.auth_tag = Some( + buzz_sdk_pkg::nip_oa::compute_auth_tag(&compat_owner, &agent, "").map_err(|e| { + format!( + "failed to compute NIP-OA auth tag for {}: {e}", + record.pubkey + ) + })?, + ); + record.updated_at = now_iso(); + changed += 1; + } + if changed > 0 { + save_managed_agents(app, &records)?; + } + Ok(changed) +} #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] diff --git a/desktop/src-tauri/src/commands/agents.rs b/desktop/src-tauri/src/commands/agents.rs index db9562e8d1..dd61fc9398 100644 --- a/desktop/src-tauri/src/commands/agents.rs +++ b/desktop/src-tauri/src/commands/agents.rs @@ -18,46 +18,6 @@ use crate::{ util::now_iso, }; -pub(super) fn backfill_missing_agent_auth_tags( - app: &AppHandle, - state: &AppState, -) -> Result { - let owner_keys = state.signing_keys()?; - let compat_owner = nostr::Keys::parse(&owner_keys.secret_key().to_secret_hex()) - .map_err(|e| format!("failed to bridge owner keys: {e}"))?; - let _store_guard = state - .managed_agents_store_lock - .lock() - .map_err(|e| e.to_string())?; - let mut records = load_managed_agents(app)?; - let mut changed = 0; - for record in &mut records { - if record.auth_tag.is_some() - || record - .pubkey - .eq_ignore_ascii_case(&owner_keys.public_key().to_hex()) - { - continue; - } - let agent = nostr::PublicKey::from_hex(&record.pubkey) - .map_err(|e| format!("invalid managed agent pubkey {}: {e}", record.pubkey))?; - record.auth_tag = Some( - buzz_sdk_pkg::nip_oa::compute_auth_tag(&compat_owner, &agent, "").map_err(|e| { - format!( - "failed to compute NIP-OA auth tag for {}: {e}", - record.pubkey - ) - })?, - ); - record.updated_at = now_iso(); - changed += 1; - } - if changed > 0 { - save_managed_agents(app, &records)?; - } - Ok(changed) -} - /// Read the workspace owner pubkey without holding the lock. Used to populate `BUZZ_ACP_AGENT_OWNER` /// as a fallback for legacy agent records that have no NIP-OA `auth_tag`. pub(super) fn workspace_owner_hex(state: &AppState) -> Result { diff --git a/desktop/src-tauri/src/commands/workspace.rs b/desktop/src-tauri/src/commands/workspace.rs index 32f041cda0..26739bfab8 100644 --- a/desktop/src-tauri/src/commands/workspace.rs +++ b/desktop/src-tauri/src/commands/workspace.rs @@ -230,7 +230,7 @@ pub async fn apply_workspace( try_regenerate_nest(&app); if is_local_workspace { - let changed = crate::commands::agents::backfill_missing_agent_auth_tags(&app, &state)?; + let changed = super::agent_auth::backfill_missing_agent_auth_tags(&app, &state)?; if changed > 0 { eprintln!("buzz-desktop: backfilled NIP-OA auth tags for {changed} local agent(s)"); } diff --git a/desktop/src-tauri/src/local_relay.rs b/desktop/src-tauri/src/local_relay.rs index 4813631af5..7fd6497ace 100644 --- a/desktop/src-tauri/src/local_relay.rs +++ b/desktop/src-tauri/src/local_relay.rs @@ -325,9 +325,11 @@ fn capture_stderr( fn stderr_context(stderr: &StderrTail) -> String { let tail = stderr.lock().expect("stderr tail mutex poisoned"); let text = String::from_utf8_lossy(&tail).trim().to_string(); - (!text.is_empty()) - .then(|| format!("; stderr: {text}")) - .unwrap_or_default() + if text.is_empty() { + String::new() + } else { + format!("; stderr: {text}") + } } fn allocate_distinct_loopback_ports(