diff --git a/desktop/src/features/agents/hooks.ts b/desktop/src/features/agents/hooks.ts index 0958ff371..1ff313a92 100644 --- a/desktop/src/features/agents/hooks.ts +++ b/desktop/src/features/agents/hooks.ts @@ -209,7 +209,16 @@ export function useRelayAgentsQuery(options?: { enabled?: boolean }) { queryKey: relayAgentsQueryKey, queryFn: listRelayAgents, staleTime: 30_000, - refetchInterval: 30_000, + // Relay agent profiles (kind:10100) are near-static and the backing + // `list_relay_agents` command is an unfiltered relay query for the whole + // profile set — mounted on ~13 always-live surfaces (channel screen, + // members bar, mentions, sidebar, profile popovers), so a tight interval + // re-pulls the full set app-wide. This poll is also the ONLY refresh path: + // the `agents-data-changed` event fires only for local persona/team/managed + // reconcile (kinds PERSONA/TEAM/MANAGED_AGENT), never for kind:10100. So we + // keep polling but at a relaxed cadence and pause it while backgrounded. + refetchInterval: 5 * 60_000, + refetchIntervalInBackground: false, enabled: options?.enabled, }); }