Skip to content

fix(desktop): retain distinct agent instances in autocomplete - #5202

Merged
atishpatel merged 2 commits into
mainfrom
workerbee/fix-agent-mention-duplicates
Aug 7, 2026
Merged

fix(desktop): retain distinct agent instances in autocomplete#5202
atishpatel merged 2 commits into
mainfrom
workerbee/fix-agent-mention-duplicates

Conversation

@atishpatel

Copy link
Copy Markdown
Contributor

Summary

  • preserve each distinct agent pubkey in autocomplete even when agents share a persona or owner/name
  • continue to collapse duplicate source rows for the same normalized pubkey
  • show a truncated pubkey in the channel member-add picker so same-named instances are selectable

Validation

  • pnpm --filter buzz test — 4,489 passed
  • pnpm --filter buzz exec tsc --noEmit --pretty false
  • pnpm --filter buzz exec biome check src/features/agents/lib/agentAutocompleteEligibility.ts src/features/agents/lib/agentAutocompleteEligibility.test.mjs src/features/channels/ui/MembersSidebar.tsx
  • independent validation by Fast Fizz on 509cb8d97b82f9708e24d4d59ad17c7b39516643: typecheck, focused Biome, 22/22 focused tests, and git diff --check

Generated by Hardworking Honey.

Co-authored-by: Hardworking Honey <c5c455215c2506cb8ba776518cec804af62d3a0526e32d496a22072e395042b9@buzz.block.builderlab.xyz>
Signed-off-by: Hardworking Honey <c5c455215c2506cb8ba776518cec804af62d3a0526e32d496a22072e395042b9@buzz.block.builderlab.xyz>
@wesbillman

Copy link
Copy Markdown
Collaborator

Thorough review by Carl on Wes’s behalf at exact head 509cb8d97b82f9708e24d4d59ad17c7b39516643: this fix is needed, correctly scoped, and not covered by PR #4999. No code blocker found.

The existing coalescer treats personaId or (owner, display name) as an agent identity. That is false for managed instances: two distinct pubkeys can intentionally share both. The result is loss, not cosmetic duplication—one real agent becomes impossible to select in @mention, new-DM, and channel member-add autocomplete. This patch changes only agent coalescing to normalized pubkey identity while retaining source-row deduplication for the same pubkey and the existing preference ranking for duplicate representations.

#4999 is complementary, not duplicative. It syncs/rehydrates private managed-agent configuration and enumerates/materializes relay-only records keyed by agent pubkey. It does not modify agentAutocompleteEligibility.ts, MembersSidebar.tsx, or any autocomplete coalescing call site; its frontend changes are only usePersonaSync. Indeed, #4999 can make this bug more visible on fresh devices by surfacing multiple legitimate relay records that the current frontend then collapses by shared persona/name. #5202 is independently useful on current main and remains necessary if #4999 lands.

I traced all three helper consumers: mention autocomplete, new-message recipients, and member-add. Candidate assembly already deduplicates repeated source rows by normalized pubkey before this helper; the helper’s remaining role is now correctly “merge duplicate representations of one pubkey,” not “guess that two keys are one agent.” Existing mention UI already displays truncated npubs on same-name collisions, new-DM rows expose the pubkey on hover, and this PR adds an always-visible truncated key for agent member-add rows, so retained duplicates are distinguishable. Eligibility, archival, channel-membership, and reachability gates remain unchanged.

Focused validation: pnpm typecheck passed; all 22/22 eligibility tests passed; Biome on all three changed files passed; git diff --check passed; worktree clean; remote head unchanged. CI is still running, so merge remains gated on exact-head CI and the PR leaving draft.

One non-blocking cleanup opportunity: currentPubkey and getLabel are now compatibility-only arguments and are intentionally underscored. Removing them from the helper API and its three callers would reduce dead conceptual surface, but it is not worth delaying this bug fix if the author prefers the smaller call-site diff.

@atishpatel
atishpatel marked this pull request as ready for review August 7, 2026 16:50
@atishpatel
atishpatel requested a review from a team as a code owner August 7, 2026 16:50
Co-authored-by: Hardworking Honey <c5c455215c2506cb8ba776518cec804af62d3a0526e32d496a22072e395042b9@buzz.block.builderlab.xyz>
Signed-off-by: Hardworking Honey <c5c455215c2506cb8ba776518cec804af62d3a0526e32d496a22072e395042b9@buzz.block.builderlab.xyz>
@atishpatel
atishpatel enabled auto-merge (squash) August 7, 2026 17:18
@atishpatel
atishpatel merged commit e9925db into main Aug 7, 2026
26 checks passed
@atishpatel
atishpatel deleted the workerbee/fix-agent-mention-duplicates branch August 7, 2026 17:32
atishpatel added a commit that referenced this pull request Aug 7, 2026
…-log-harness

* origin/main:
  feat(desktop): adding rich link previews to messages (#3818)
  fix(buzz-agent): Responses reasoning summary, Anthropic display:summarized, ACP v2 messageId (#5195)
  fix(desktop): retain distinct agent instances in autocomplete (#5202)
  fix(desktop): defer channel visibility change to Save (#5203)
  feat(desktop): Projects follow-ups — access restrictions, fast loading, activity feed polish (#5073)
  refactor(cli): replace probe/decider/detail split with single typed extractor (#5191)
  fix(desktop): drop unhandled rejection from throwing window.Notification (#5143)
  fix(desktop): fence localStorage SecurityError from killing the React tree (#5142)
  fix(desktop): make terminal output selectable (#4980)
  fix(desktop): use WEBKIT_DMABUF_RENDERER_FORCE_SHM for NVIDIA/AppImage (#3654) (#4505)
  Make public starter channels best effort (#5192)
  Mobile: add anchored reaction popover (#5025)
  feat(mobile): add bee pull-to-refresh (#5059)

Signed-off-by: Atish Patel <atish@squareup.com>
kbst9 added a commit to kbst9/buzz that referenced this pull request Aug 7, 2026
Conflict resolutions, upstream-as-default:
- config.rs: drop the fork's require_media_get_auth staging flag — upstream
  block#4610 made authenticated media reads unconditional; keep file_index_enabled.
- ingest.rs: kind-list unions (upstream KIND_PRIVATE_MANAGED_AGENT + fork
  KIND_SWARM/KIND_COMMUNITY_GUIDE).
- Link previews (block#3818) x swarm tags: splitOutgoingTags routes both tag
  kinds; sendChannelMessage carries linkPreviewTags (upstream position) and
  swarmTags (appended); HomeView caller realigned — positional same-typed
  params, invisible to tsc.
- ChannelPane: upstream WelcomeComposerGuidanceLayer render kept, driven by
  the fork's useWelcomeComposerBanner state; old Banner import dropped.
- swarmDialogState: adopt block#5202 pubkey-keyed agent identity — distinct
  same-name agents stay separate swarm picker options (collapse made one
  unpickable); fork test updated.

SettingsPanels.tsx grew 930->1010 from upstream's side — over-cap, split
owed (same bucket as MembersSidebar). Verified: tsc, desktop suite (4663),
cargo check buzz-relay, fmt.

Signed-off-by: kbst9 <kevinbsteiner@gmail.com>
wpfleger96 pushed a commit that referenced this pull request Aug 7, 2026
* origin/main: (32 commits)
  Recover from max-token response truncation (#5223)
  chore(release): release Buzz Desktop version 0.5.6 (#5214)
  fix(mobile): keep latest messages above composer (#4981)
  fix(sdk): preserve self-mention p tags in message and forum event builders (#4975)
  bump @tauri-apps/cli to ~2.11.4 to fix linux app icon issue (#4858)
  feat(desktop): adding rich link previews to messages (#3818)
  fix(buzz-agent): Responses reasoning summary, Anthropic display:summarized, ACP v2 messageId (#5195)
  fix(desktop): retain distinct agent instances in autocomplete (#5202)
  fix(desktop): defer channel visibility change to Save (#5203)
  feat(desktop): Projects follow-ups — access restrictions, fast loading, activity feed polish (#5073)
  refactor(cli): replace probe/decider/detail split with single typed extractor (#5191)
  fix(desktop): drop unhandled rejection from throwing window.Notification (#5143)
  fix(desktop): fence localStorage SecurityError from killing the React tree (#5142)
  fix(desktop): make terminal output selectable (#4980)
  fix(desktop): use WEBKIT_DMABUF_RENDERER_FORCE_SHM for NVIDIA/AppImage (#3654) (#4505)
  Make public starter channels best effort (#5192)
  Mobile: add anchored reaction popover (#5025)
  feat(mobile): add bee pull-to-refresh (#5059)
  Remove agent creation success modal (#5063)
  fix(buzz-agent): escalate LLM timeouts per retry and log per-call latency (#5130)
  ...

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>

# Conflicts:
#	desktop/src/shared/api/tauri.ts
wpfleger96 pushed a commit that referenced this pull request Aug 7, 2026
…format

* origin/main: (60 commits)
  feat(desktop): unify add agent flows (#5015)
  fix(buzz-agent): budget summarizer reasoning separately so it cannot starve the handoff summary (#5248)
  infra: bind development services to loopback (#4871)
  chore(release): release Buzz Desktop version 0.5.7 (#5252)
  fix(desktop): isolate relay admission tests (#5221)
  fix(desktop): externalize boot <style> to prevent Tauri CSP nonce override (#5242)
  fix(desktop): let imported and recovered identities finish onboarding (#5228)
  Recover from max-token response truncation (#5223)
  chore(release): release Buzz Desktop version 0.5.6 (#5214)
  fix(mobile): keep latest messages above composer (#4981)
  fix(sdk): preserve self-mention p tags in message and forum event builders (#4975)
  bump @tauri-apps/cli to ~2.11.4 to fix linux app icon issue (#4858)
  feat(desktop): adding rich link previews to messages (#3818)
  fix(buzz-agent): Responses reasoning summary, Anthropic display:summarized, ACP v2 messageId (#5195)
  fix(desktop): retain distinct agent instances in autocomplete (#5202)
  fix(desktop): defer channel visibility change to Save (#5203)
  feat(desktop): Projects follow-ups — access restrictions, fast loading, activity feed polish (#5073)
  refactor(cli): replace probe/decider/detail split with single typed extractor (#5191)
  fix(desktop): drop unhandled rejection from throwing window.Notification (#5143)
  fix(desktop): fence localStorage SecurityError from killing the React tree (#5142)
  ...

Signed-off-by: Duncan <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@buzz.block.builderlab.xyz>
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.

2 participants