mirror of
https://github.com/block/buzz.git
synced 2026-11-16 06:11:34 +00:00
fix: pass context to single-add mutation so reuse guard fires
The single-agent create path was calling createChannelManagedAgent without context, so the reuse guard (findReusablePersonaAgent) never fired — always spawning a new keypair + process. Now fetches managedAgents + channelMemberPubkeys before calling create, matching the batch path's behavior.
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
discoverAcpProviders,
|
||||
discoverBackendProviders,
|
||||
discoverManagedAgentPrereqs,
|
||||
getChannelMembers,
|
||||
getManagedAgentLog,
|
||||
listManagedAgents,
|
||||
listRelayAgents,
|
||||
@@ -417,7 +418,18 @@ export function useCreateChannelManagedAgentMutation(channelId: string | null) {
|
||||
throw new Error("No channel selected.");
|
||||
}
|
||||
|
||||
return createChannelManagedAgent(channelId, input);
|
||||
const [managedAgents, members] = await Promise.all([
|
||||
listManagedAgents(),
|
||||
getChannelMembers(channelId),
|
||||
]);
|
||||
const channelMemberPubkeys = new Set(
|
||||
members.map((m) => normalizePubkey(m.pubkey)),
|
||||
);
|
||||
|
||||
return createChannelManagedAgent(channelId, input, {
|
||||
managedAgents,
|
||||
channelMemberPubkeys,
|
||||
});
|
||||
},
|
||||
onSuccess: (result) => {
|
||||
if (!channelId) return;
|
||||
|
||||
Reference in New Issue
Block a user