fix(desktop): clear local mode push checks

Signed-off-by: Brother Darryl <146fb160a3266e6165bfa385f6048c975eda9e21cf65da097a0b5ea7952532a5@buzz.block.builderlab.xyz>
This commit is contained in:
Brother Darryl
2026-08-10 19:38:03 -04:00
parent 67debfa7eb
commit aaf4be8490
4 changed files with 51 additions and 44 deletions

View File

@@ -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<usize, String> {
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")]

View File

@@ -18,46 +18,6 @@ use crate::{
util::now_iso,
};
pub(super) fn backfill_missing_agent_auth_tags(
app: &AppHandle,
state: &AppState,
) -> Result<usize, String> {
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<String, String> {

View File

@@ -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)");
}

View File

@@ -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(