fix(desktop): mention autocomplete drops every relay-directory agent before eligibility runs - #3292
Open
TNovs1 wants to merge 1 commit into
Open
fix(desktop): mention autocomplete drops every relay-directory agent before eligibility runs#3292TNovs1 wants to merge 1 commit into
TNovs1 wants to merge 1 commit into
Conversation
…ng every hosted agent `isAgentIdentityInManagedList` is called with `managedAgentPubkeys` — agents this installation runs locally. Any other agent arrives with isAgent=true and is dropped there, BEFORE `shouldHideAgentFromMentions`, so `relayAgentIsSharedWithUser`, the respond_to allowlist and channel membership are never consulted for it. That makes an entire branch of the eligibility module unreachable: an agent hosted elsewhere cannot be @-mentioned no matter what it publishes, even when it is a member of the channel, is in the user's own respond_to allowlist, and appears in the relay directory — and the relay-agent candidate loop a few lines below, which exists to offer exactly those agents, can never produce a visible suggestion. The trigger is ordinary NIP-OA attestation: the relay sets users.agent_owner_pubkey (write-once), the members/profiles API returns is_agent, and the candidate is flagged an agent. So attesting an agent — the thing that earns it the bot badge and "managed by <org>" — is also what makes it unmentionable. Reproduced against a hosted 8-agent fleet: all eight were channel members with the user in their allowlist and complete kind:10100 profiles, and none could be @-mentioned; three locally-managed agents in the same channel could. Gate on managed ∪ relay directory instead, via the same `mergeKnownAgentPubkeys` helper `useKnownAgentPubkeys` already uses app-wide, restoring the intended layering: identity/ownership decides who is KNOWN, the eligibility rules decide who is INVOCABLE. `shouldHideAgentFromMentions` still applies, so a directory agent that excludes this user is still hidden.
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.
Problem
useMentionsgates every autocomplete candidate throughisAgentIdentityInManagedListagainst only the local managed-agent set. Any candidate flaggedisAgent: truethat is not managed by this desktop is dropped beforeshouldHideAgentFromMentionsruns — sorelayAgentIsSharedWithUser, therespond_toallowlist, and channel membership are never consulted for it. The entire relay-agent branch ofagentAutocompleteEligibilityis unreachable from the mention picker.Net effect: an agent hosted anywhere other than the local desktop (registered in the relay agent directory via kind:10100, attested via NIP-OA, or both) can never be @-mentioned, even when its directory entry explicitly allowlists the current user.
Reproduction
respond_to: "allowlist"including your pubkey.@— the agent is never offered.Fix
Gate the candidate loop on
mergeKnownAgentPubkeys(managedAgentsQuery.data, relayAgentsQuery.data)— the same managed ∪ relay-directory union the app already treats as "known agents" elsewhere (useKnownAgentPubkeys). Identity decides who is known; the eligibility rules (shouldHideAgentFromMentions→relayAgentIsSharedWithUser) keep deciding who is invocable — a directory agent whose entry excludes the viewer is still hidden, as before.One line of behavior change plus a memoized union; no new API surface.