From 4fe66cfb0632cbb9b729945a7ffb46adccaf940e Mon Sep 17 00:00:00 2001 From: klopez4212 Date: Fri, 19 Jun 2026 13:10:54 +0100 Subject: [PATCH] Address remaining agent profile review feedback --- .../src/managed_agents/persona_card.rs | 2 +- .../channels/ui/AddChannelBotDialog.tsx | 11 ++++++++-- .../features/profile/ui/UserProfilePanel.tsx | 9 +++++++++ .../profile/ui/UserProfilePanelDeletion.ts | 20 +++++++++++++++---- 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/desktop/src-tauri/src/managed_agents/persona_card.rs b/desktop/src-tauri/src/managed_agents/persona_card.rs index d732284b8..f933c7467 100644 --- a/desktop/src-tauri/src/managed_agents/persona_card.rs +++ b/desktop/src-tauri/src/managed_agents/persona_card.rs @@ -82,7 +82,7 @@ pub fn parse_png_persona(png_bytes: &[u8]) -> Result { + if (!allowForceNewInstance) { + setForceNewInstance(false); + } + }, [allowForceNewInstance]); + const { runtimeWarnings, effectiveRuntimes } = useEffectiveRuntimes( personas, selectedPersonas, @@ -360,7 +368,6 @@ export function AddChannelBotDialog({ model: persona.model ?? undefined, role: "bot" as const, backend, - forceNewInstance, ...respondToFields, }; }), @@ -613,7 +620,7 @@ export function AddChannelBotDialog({ /> ) : null} - {reusableAgent ? ( + {reusableAgent && allowForceNewInstance ? (
{ + const personaId = persona?.id ?? managedAgent?.personaId; + if (personaId) { + const refreshedPersona = personasQuery.data?.find( + (candidate) => candidate.id === personaId, + ); + if (refreshedPersona) { + return refreshedPersona; + } + } if (persona) { return persona; } diff --git a/desktop/src/features/profile/ui/UserProfilePanelDeletion.ts b/desktop/src/features/profile/ui/UserProfilePanelDeletion.ts index 3367d84a2..2e4b30135 100644 --- a/desktop/src/features/profile/ui/UserProfilePanelDeletion.ts +++ b/desktop/src/features/profile/ui/UserProfilePanelDeletion.ts @@ -48,15 +48,27 @@ export function useProfileAgentDeletion({ }: UseProfileAgentDeletionInput) { const removeAgentFromAllChannels = React.useCallback( async (agentPubkey: string) => { - const channelIds = getRelayAgentChannelIds(relayAgents, agentPubkey); - if (channelIds.length === 0) return; + const normalizedPubkey = agentPubkey.toLowerCase(); + const channelIds = new Set( + getRelayAgentChannelIds(relayAgents, agentPubkey), + ); + for (const channel of channels ?? []) { + if ( + channel.memberPubkeys.some( + (memberPubkey) => memberPubkey.toLowerCase() === normalizedPubkey, + ) + ) { + channelIds.add(channel.id); + } + } + if (channelIds.size === 0) return; await Promise.allSettled( - channelIds.map((channelId) => + [...channelIds].map((channelId) => removeChannelMember(channelId, agentPubkey), ), ); }, - [relayAgents], + [channels, relayAgents], ); const deleteManagedAgentRecord = React.useCallback(