fix(desktop): show shared relay agents in mention autocomplete - #4137
Open
bossriceshark wants to merge 5 commits into
Open
fix(desktop): show shared relay agents in mention autocomplete#4137bossriceshark wants to merge 5 commits into
bossriceshark wants to merge 5 commits into
Conversation
Mention candidates were dropped by isAgentIdentityInManagedList before shouldHideAgentFromMentions ever ran, so remote relay agents — which can never enter the local managed list (apply_inbound_managed_agent is patch-only by design) — were unmentionable on desktop even when their kind:10100 directory records made them eligible. Mobile has no such filter and shows them. Admit candidates through the mentionable set (managed agents plus directory-eligible relay agents) instead — the same eligibility useNewMessageRecipients already trusts. Agents in neither set stay hidden, preserving the guard's anti-impersonation posture. isAgentIdentityInManagedList is unchanged for its remaining consumer (MembersSidebar add-member search). Signed-off-by: Matt Rice <bossriceshark@users.noreply.github.com>
Review findings: the case-normalization assertion used a digit-only fixture (toUpperCase() is identity on digits, so it could never fail) — replaced with a letter-bearing hex fixture; pinned the member-agent- without-directory-record path explicitly; converted the new export's comment to JSDoc per repo convention; noted that the shouldHideAgentFromMentions member branch is gated upstream. Signed-off-by: Matt Rice <bossriceshark@users.noreply.github.com>
The mention-priority smoke test asserted alice hidden — alice is the mock's shared relay agent (directory respond_to "anyone" with a shared channel, channel member, not locally managed), which is exactly the candidate class the fix admits. Update expectations to the fixed behavior and pin her member-tier ordering. Signed-off-by: Matt Rice <bossriceshark@users.noreply.github.com>
….mjs main currently fails `biome check .` on these two string concatenations; recent main pushes were docs-only so the path-filtered desktop CI job never surfaced it. Included here so this PR's CI can run green — happy to split into its own PR if preferred. Signed-off-by: Matt Rice <bossriceshark@users.noreply.github.com>
Signed-off-by: Matt Rice <bossriceshark@users.noreply.github.com>
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
Shared/remote relay agents never appear in desktop mention autocomplete, even when their kind:10100 directory records make them mention-eligible — mobile shows them fine. Root cause:
addCandidate()inuseMentions.tsdrops everyisAgentcandidate that failsisAgentIdentityInManagedList()beforeshouldHideAgentFromMentions()runs, and a remote agent can never enter the local managed list (apply_inbound_managed_agent()is patch-only by design), so the relay-directory candidate loop is dead code for non-local agents.Fix: add
isAgentIdentityMentionable()— admits non-agents, and agents present in the mentionable set fromgetMentionableAgentPubkeys()(locally managed ∪ directory-eligible relay agents, the same eligibilityuseNewMessageRecipientsandProjectsAgentPromptPagealready trust) — and switch only theuseMentionscall site to it.isAgentIdentityInManagedListis unchanged for its remaining consumer (MembersSidebaradd-member search, which may deserve the same treatment separately — noted in the issue). An agent in neither set stays hidden, preserving the guard's anti-impersonation posture. Also removes the now-stalemanagedAgentPubkeysentry from thementionCandidatesmemo deps.Two housekeeping commits are included; happy to split either into its own PR:
style(desktop):personaCatalogRelay.test.mjscurrently failsbiome check .on main (twouseTemplateviolations); recent main pushes were docs-only, so the path-filtered Desktop Core job hasn't surfaced it. This PR's CI can't go green without the two-line fix.test(desktop): the mentions smoke e2e asserted the buggy behavior — the mock'saliceis exactly a directory-eligible shared relay agent (respond_to: "anyone", shared channel) and was expected to be absent from the picker. Updated to expect her visible, with member-tier ordering pinned.Related issue
Fixes #4128 (searched existing issues/PRs for duplicates — none found)
Testing
agentAutocompleteEligibility.test.mjs(node:test) — remote directory-eligible agent admitted; agent in neither set hidden; locally managed unchanged; member-agent-without-directory-record stays hidden (pre-existing behavior, deliberately pinned); case-normalization with a letter-bearing hex fixture.mentions.spec.tsmention-priority smoke updated to the fixed behavior (see above); full desktop CI green on the fork (Desktop Core, all four Smoke E2E shards, E2E Relay).buzz-acpagent with a rich directory record gets no pill while Android shows it; with this patch the pill appears, and selecting it delivers the p-tag mention and produces an agent reply. Desktop-vs-mobile discrepancy reproduced and resolved.