Skip to content

fix(desktop): reuse managed agents on team deploy instead of force-minting - #3646

Open
matthewdcage wants to merge 1 commit into
block:mainfrom
matthewdcage:fix/team-deploy-agent-reuse
Open

fix(desktop): reuse managed agents on team deploy instead of force-minting#3646
matthewdcage wants to merge 1 commit into
block:mainfrom
matthewdcage:fix/team-deploy-agent-reuse

Conversation

@matthewdcage

Copy link
Copy Markdown

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:

  1. Removes forceNewInstance: true from AddTeamToChannelDialog.tsx so team deploy follows the same reuse path as single-agent deploy.
  2. Adds findPersonaAgentInChannel() and short-circuits provisioning when the persona is already in-channel (no mint, no duplicate member attach).
  3. Refreshes batch deploy context after each attach so subsequent personas in the same team deploy see updated channel membership.
  4. Adds buzz agents draft-update --pubkey for disambiguation when multiple agents share a display name ([Bug] Renaming or re-adding personal agents can desynchronise identity and break @mentions #2423 mitigation).
  5. Adds harness roster refresh (agents_roster.rs) so the ACP pool picks up managed-agent block changes without restart.
  6. Documents Instance pubkey in the nest AGENTS.md table 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

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

…nting

Deploy team to channel set forceNewInstance: true for every persona,
bypassing findReusablePersonaAgent and minting duplicate Nostr keypairs
with the same display name. Remove that flag, skip mint when the persona
is already in-channel, and refresh batch deploy context after each attach.

Also add draft-update --pubkey for disambiguation, Instance pubkey in the
nest AGENTS.md table, and buzz-acp roster refresh when the managed block
changes.

Fixes block#3639. Related: block#2648, block#2973, block#2423, block#3204, block#2910.

Signed-off-by: Matthew Cage <matthew@hydradigital.com.au>
Co-authored-by: Cursor <cursoragent@cursor.com>
@matthewdcage
matthewdcage requested a review from a team as a code owner July 29, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Deploy team to channel force-mints new agent keypair per persona (bypasses reuse)

1 participant