fix(desktop): admit the owner of an allowlist agent into mentions - #6284
Open
TheSeydiCharyyev wants to merge 1 commit into
Open
fix(desktop): admit the owner of an allowlist agent into mentions#6284TheSeydiCharyyev wants to merge 1 commit into
TheSeydiCharyyev wants to merge 1 commit into
Conversation
`relayAgentIsSharedWithUser` resolved the owner under `owner-only` but read `respondToAllowlist` literally under `allowlist`. The harness accepts the owner in both modes: `author_allowed` ORs the explicit list with `is_owner_or_sibling`, and the doc comment on it states that as the rule rather than an accident. The two branches sit eight lines apart, so the effect was an inversion. Widening an agent's policy from `owner-only` to `allowlist`, to let one more person in, removed the agent from its own owner's picker. The agent still answered its owner, because the harness admits them, but the owner could no longer select it and a typed mention was never tagged. An `allowlist` with an empty array was hidden from everyone, the owner included, and nothing reported an error. An owner that does not resolve still falls through to the list. On closed relays the NIP-OA attestation frequently never materializes (block#4223, relay-side fix in block#5581), and admitting on absence would expose the agent to every viewer. `getMentionableAgentPubkeys` seeds from `managedAgentPubkeys` unconditionally, so this never affected agents this Desktop runs. The population it reaches is agents the viewer owns but runs elsewhere: headless agents, and agents on another machine. The `owner-only` branch is left untouched. Sibling parity is not needed here: `is_owner_or_sibling` also accepts same-owner sibling agents, but the picker's `currentPubkey` is the human viewer. Closes block#6280 Signed-off-by: Seydi Charyyev <seydi.charyev@gmail.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
relayAgentIsSharedWithUserresolves the owner in theowner-onlybranch, but readsrespondToAllowlistliterally in theallowlistbranch. The harness accepts the owner in both modes —author_allowedORs the explicit list withis_owner_or_sibling(crates/buzz-acp/src/lib.rs:249-257) — and the doc comment above it states that as the rule, not as an accident:The two branches sit eight lines apart, so the effect is an inversion. Widening an agent's policy from
owner-onlytoallowlist, to let one more person in, removes the agent from its own owner's picker. The agent still answers its owner, because the harness admits them, but the owner can no longer select it and a typed mention is never tagged. Anallowlistwith an empty array is hidden from everyone, the owner included, and nothing reports an error.This adds the owner check to the
allowlistbranch. Two limits are deliberate:undefined,nulland""as denied.is_owner_or_siblingalso accepts same-owner sibling agents, but the picker'scurrentPubkeyis the human viewer, so only the direct owner check applies.Scope:
getMentionableAgentPubkeysseeds frommanagedAgentPubkeysunconditionally, so agents this Desktop runs were never affected. The population this reaches is agents the viewer owns but runs elsewhere — headless agents, and agents on another machine.The
owner-onlybranch is left untouched. A shared helper for both branches was considered and left out: that path was rewritten last week by #6086, #6182 and #6224, and keeping the diff away from it avoids both a conflict surface and a refactor this fix does not need.Related issue
Closes #6280.
Searched before opening. The nearest existing reports are both different:
Of the open PRs that touch
agentAutocompleteEligibility.ts, none changes how theallowlistbranch treats the owner. #2605 and #4204 are the only two that reach this area, and both target the cross-owner andowner-onlypaths.Testing
Run in
desktopon93114c9c:pnpm test— 5039/5039 (5037 before, plus the two added here)pnpm typecheck— cleanpnpm check— cleanRed/green on the two new tests, through the project's own runner:
agentAutocompleteEligibility.test.mjsnow covers an owner absent from the array, an empty array, a non-owner viewer (unchanged), an unresolved owner (denied), andrelayAgentCanRespondInChannelstill requiring channel membership for the owner.No screenshot: the visible effect is one entry appearing in the existing
@list, and reproducing it needs a relay plus an agent running outside Desktop. The behaviour is pinned by the unit tests instead.