Skip to content

fix(desktop): coalesce persona defs with running instances in @ picker (#3947) - #4056

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue3947-20260801
Open

fix(desktop): coalesce persona defs with running instances in @ picker (#3947)#4056
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue3947-20260801

Conversation

@iroiro147

Copy link
Copy Markdown

Summary

Fixes #3947 — the @ mention picker could offer persona-definition rows as managed by you · not in channel while omitting the actual locally managed running instances that are channel members.

Root cause

Two candidate-assembly defects in useMentions.ts:

  1. Persona-definition records with empty pubkey were admitted. managed-agents.json can carry persona-definition rows whose pubkey is "" (their running instance carries the real one). addCandidate normalized "" and admitted the row as an agent candidate, so phantom "managed by you" rows rendered and could shadow the real instance — the definition row would never resolve a p tag.

  2. Running instances were not enriched with their linked persona's display name. The instance's own name (often null) won, so the picker showed an unnamed instance and the persona row as a separate "managed by you" duplicate instead of coalescing on instance.persona_id == persona.id.

Fix

In desktop/src/features/messages/lib/useMentions.ts:

  • addCandidate guard: skip any candidate whose normalized pubkey is blank (if (!pubkey) return;). Persona-definition rows never render as candidates; membership and delivery stay keyed by the instance pubkey.
  • Managed-agents loop: when agent.personaId links to an active persona, prefer the persona's displayName for presentation (agent.name || linkedPersonaName || null). The instance row becomes a properly named candidate that coalesces with its channel-member entry instead of rendering as a separate phantom.

Verification

  • pnpm typecheck — clean
  • pnpm exec biome check src/features/messages/lib/useMentions.ts — clean
  • pnpm build:e2e && CI=1 npx playwright test --project=smoke — composer flows exercised

What this does not change

  • No change to the persona-definition data model or backend serialization; the empty-pubkey rows are simply ignored at the picker boundary.
  • No change to p-tag delivery (membership-keyed path unchanged).
  • No fuzzy matching introduced.

block#3947)

On Buzz Desktop, the mention picker could offer account-synced
persona-definition rows as 'not in channel' while omitting the actual
locally managed running instances that are channel members.

Two candidate-assembly defects:

1. Persona-definition records in managed-agents.json can carry an empty
   pubkey (their running instance carries the real one). addCandidate
   admitted them as agent candidates, so phantom rows rendered and could
   shadow the real instance. Skip any candidate whose normalized pubkey
   is blank.

2. Running instances were not enriched with their linked persona's
   displayName — the instance's own (often null) name won, so the
   picker showed an unnamed instance and the persona row as a separate
   'managed by you' duplicate. When agent.personaId links to an active
   persona, prefer the persona's displayName for presentation; membership
   and delivery stay keyed by the instance pubkey (join:
   instance.persona_id == persona.id).

Verified: pnpm typecheck clean, biome check clean.

Fixes block#3947

Signed-off-by: iroiro147 <sarthak.singh@juspay.in>
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.

Mention picker fails to coalesce local persona definitions with their running channel-member instances

1 participant