buzz
buzz copied to clipboard
fix(desktop): reuse managed agents on team deploy instead of force-minting
Summary
Fixes #3639.
Deploy team to channel always passed forceNewInstance: true for every persona, which bypassed findReusablePersonaAgent() in provisionChannelManagedAgent() and minted a fresh Nostr keypair on each deploy — even when the same persona was already attached to the channel with a running managed instance.
This PR:
- Removes
forceNewInstance: truefromAddTeamToChannelDialog.tsxso team deploy follows the same reuse path as single-agent deploy. - Adds
findPersonaAgentInChannel()and short-circuits provisioning when the persona is already in-channel (no mint, no duplicate member attach). - Refreshes batch deploy context after each attach so subsequent personas in the same team deploy see updated channel membership.
- Adds
buzz agents draft-update --pubkeyfor disambiguation when multiple agents share a display name (#2423 mitigation). - Adds harness roster refresh (
agents_roster.rs) so the ACP pool picks up managed-agent block changes without restart. - Documents Instance pubkey in the nest
AGENTS.mdtable for operator clarity.
Root cause (confirmed on origin/main)
// AddTeamToChannelDialog.tsx (main)
forceNewInstance: true, // ← bypasses reuse for every persona
Live reproduction (ai-advantage community)
Repeated Deploy team to channel on the same team/channel grew channel bot membership from 12 distinct running instances to ~24 pubkeys with duplicate display names. Manual cleanup via buzz channels remove-member for stale pubkeys restored 12 canonical instances.
Related issues
| Issue | Relationship |
|---|---|
| #3639 | Primary — this PR fixes the team-deploy mint bypass |
| #2648 | Second-install mint on same machine — not fixed here |
| #2973 | Archive failure leaves ghost channel members — workaround unchanged |
| #2423 | --pubkey draft-update mitigation included |
| #3204 | Agent picker confusion worsened by duplicates — scope boundary |
| #2910 | Same-owner team-deploy collision — improved by reuse, not fully deduped server-side |
Out of scope
- Backend dedup in
create_managed_agentbypersona_id - Agent picker filtering by running state (#3204)
- Archive/remove-member UX (#2973)
Testing
Verified locally on branch fix/team-deploy-agent-reuse (rebased on latest origin/main):
| Command | Result |
|---|---|
cargo test -p buzz-cli agent_management |
4 passed |
cargo test -p buzz-acp --lib extract_managed |
1 passed |
cargo clippy -p buzz-cli -p buzz-acp -- -D warnings |
pass |
node --test desktop/src/features/agents/agentManagement.test.mjs |
10 passed |
cargo test --manifest-path desktop/src-tauri/Cargo.toml nest::tests |
42 passed |
just desktop-tauri-fmt |
pass |
Manual test plan
- [ ] Deploy a team to a channel once → N agents created (one per persona)
- [ ] Deploy the same team to the same channel again → no new keypairs, existing instances reused
- [ ] Channel member list shows one pubkey per persona display name
- [ ]
buzz agents draft-update --pubkey <hex> --name "…"targets the correct agent when names collide