diff --git a/desktop/src-tauri/src/managed_agents/discovery.rs b/desktop/src-tauri/src/managed_agents/discovery.rs index bc0e3a6cdae..0f007a489a0 100644 --- a/desktop/src-tauri/src/managed_agents/discovery.rs +++ b/desktop/src-tauri/src/managed_agents/discovery.rs @@ -482,16 +482,16 @@ fn profile_target_dirs(root: &Path) -> [PathBuf; 2] { } fn command_search_dirs() -> Vec { - let mut dirs = profile_target_dirs(&workspace_root_dir()).to_vec(); + // Packaged sidecars must win over compile-time workspace build output. + let mut dirs: Vec<_> = std::env::current_exe() + .ok() + .and_then(|path| path.parent().map(Path::to_path_buf)) + .into_iter() + .collect(); + dirs.extend(profile_target_dirs(&workspace_root_dir())); if let Ok(current_dir) = std::env::current_dir() { dirs.extend(profile_target_dirs(¤t_dir)); } - - dirs.extend( - std::env::current_exe() - .ok() - .and_then(|path| path.parent().map(Path::to_path_buf)), - ); dirs.into_iter().fold(Vec::new(), |mut unique, dir| { if !unique.contains(&dir) { unique.push(dir); diff --git a/desktop/src/features/dkg-memory/hooks.ts b/desktop/src/features/dkg-memory/hooks.ts index 6384062483f..eb06d734af9 100644 --- a/desktop/src/features/dkg-memory/hooks.ts +++ b/desktop/src/features/dkg-memory/hooks.ts @@ -8,6 +8,7 @@ import { fetchTrustNetwork, } from "./api"; import { fetchDkgMemoryCapabilities } from "./capabilities"; +import { dkgReadQueryPolicy } from "./queryLoadPolicy"; const CAPABILITY_RETRY_DELAYS_MS = [250, 1_000, 5_000] as const; @@ -61,7 +62,7 @@ export function useChannelMemory( queryKey: ["dkg-memory", "memory", channelId, cg], queryFn: () => fetchChannelMemory(channelId as string, cg ?? null), enabled: Boolean(channelId) && bindingResolved, - refetchInterval: 30 * 1000, + ...dkgReadQueryPolicy, }); } @@ -83,7 +84,7 @@ export function useTrustNetwork(channelId: string | null) { queryKey: ["dkg-memory", "trust-network", channelId], queryFn: () => fetchTrustNetwork(channelId as string), enabled: Boolean(channelId), - refetchInterval: 30 * 1000, + ...dkgReadQueryPolicy, }); } @@ -96,7 +97,7 @@ export function useReputationSummary( queryFn: () => fetchReputationSummary(channelId as string, pubkey as string), enabled: Boolean(channelId && pubkey), - staleTime: 30 * 1_000, + ...dkgReadQueryPolicy, }); } diff --git a/desktop/src/features/dkg-memory/queryLoadPolicy.test.mjs b/desktop/src/features/dkg-memory/queryLoadPolicy.test.mjs new file mode 100644 index 00000000000..9e4f1c03df0 --- /dev/null +++ b/desktop/src/features/dkg-memory/queryLoadPolicy.test.mjs @@ -0,0 +1,18 @@ +import assert from "node:assert/strict"; +import test from "node:test"; + +import { + DKG_READ_STALE_TIME_MS, + dkgReadQueryPolicy, +} from "./queryLoadPolicy.ts"; + +test("heavy DKG reads are cached briefly without polling or retry amplification", () => { + assert.equal(DKG_READ_STALE_TIME_MS, 30_000); + assert.deepEqual(dkgReadQueryPolicy, { + retry: false, + refetchInterval: false, + refetchOnReconnect: false, + refetchOnWindowFocus: false, + staleTime: 30_000, + }); +}); diff --git a/desktop/src/features/dkg-memory/queryLoadPolicy.ts b/desktop/src/features/dkg-memory/queryLoadPolicy.ts new file mode 100644 index 00000000000..d702e18602c --- /dev/null +++ b/desktop/src/features/dkg-memory/queryLoadPolicy.ts @@ -0,0 +1,14 @@ +/** + * DKG reads can fan out into several triple-store operations. Keep them + * user-driven and cache the successful result briefly instead of polling or + * multiplying an overloaded upstream with automatic retries. + */ +export const DKG_READ_STALE_TIME_MS = 30_000; + +export const dkgReadQueryPolicy = { + retry: false, + refetchInterval: false, + refetchOnReconnect: false, + refetchOnWindowFocus: false, + staleTime: DKG_READ_STALE_TIME_MS, +} as const; diff --git a/desktop/src/features/dkg-memory/ui/WebOfTrustPanel.tsx b/desktop/src/features/dkg-memory/ui/WebOfTrustPanel.tsx index 1cb9fd396a9..f2a0026a8b6 100644 --- a/desktop/src/features/dkg-memory/ui/WebOfTrustPanel.tsx +++ b/desktop/src/features/dkg-memory/ui/WebOfTrustPanel.tsx @@ -4,6 +4,7 @@ import { History, Link2, Loader2, + RefreshCw, ShieldCheck, ShieldX, UserRoundCheck, @@ -212,6 +213,17 @@ export function WebOfTrustPanel({ ? network.error.message : "The community DKG did not return a trust network."}

+ ); } @@ -242,7 +254,20 @@ export function WebOfTrustPanel({ signed vouches

- DKG evidence +
+ DKG evidence + +
{people.length === 0 ? (