fix(desktop): coalesce persona defs with running instances in @ picker (#3947) - #4056
Open
iroiro147 wants to merge 1 commit into
Open
fix(desktop): coalesce persona defs with running instances in @ picker (#3947)#4056iroiro147 wants to merge 1 commit into
iroiro147 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3947 — the
@mention picker could offer persona-definition rows asmanaged by you · not in channelwhile omitting the actual locally managed running instances that are channel members.Root cause
Two candidate-assembly defects in
useMentions.ts:Persona-definition records with empty pubkey were admitted.
managed-agents.jsoncan carry persona-definition rows whosepubkeyis""(their running instance carries the real one).addCandidatenormalized""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 aptag.Running instances were not enriched with their linked persona's display name. The instance's own
name(oftennull) won, so the picker showed an unnamed instance and the persona row as a separate "managed by you" duplicate instead of coalescing oninstance.persona_id == persona.id.Fix
In
desktop/src/features/messages/lib/useMentions.ts:addCandidateguard: 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.agent.personaIdlinks to an active persona, prefer the persona'sdisplayNamefor 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— cleanpnpm exec biome check src/features/messages/lib/useMentions.ts— cleanpnpm build:e2e && CI=1 npx playwright test --project=smoke— composer flows exercisedWhat this does not change
p-tag delivery (membership-keyed path unchanged).