Skip to content

fix(desktop): allow shared agent mentions - #3056

Closed
joahg wants to merge 1 commit into
block:mainfrom
joahg:fix/cross-owner-agent-mentions
Closed

fix(desktop): allow shared agent mentions#3056
joahg wants to merge 1 commit into
block:mainfrom
joahg:fix/cross-owner-agent-mentions

Conversation

@joahg

@joahg joahg commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • allow Desktop mention autocomplete to include another owner's agent when the existing relay policy says the current user can invoke it
  • preserve archived-candidate exclusion and the existing preference for live managed identities
  • keep the local-ownership filter scoped to add-member search
  • add regression coverage for a cross-owner channel bot configured with respondTo: anyone

Problem

useMentions rejected every agent identity that was not in the current user's locally managed-agent set before applying the existing mention visibility and invocability policy.
That removed cross-owner channel bots from autocomplete even when they were shared with the user and configured to respond to anyone. Because the candidate never entered the mention map, message sending received no recipient pubkey and emitted no corresponding p tag.

Fix

Move the complete mention candidate decision behind a tested admission helper that applies:

  1. archived identity exclusion
  2. the existing invocability and relay-directory visibility policy
    The ownership-only helper remains unchanged for add-member search, where that restriction is intentional.

Testing

  • cd desktop && pnpm check
  • cd desktop && pnpm test — 3,631 passed
  • cd desktop && pnpm typecheck
  • cd desktop && pnpm build
    The regression test covers a channel bot owned by another user, with no locally managed identity and respondTo: anyone, at the candidate-admission seam used by useMentions.

Co-authored-by: Joah Gerstenberg <me@joahg.com>
Signed-off-by: Joah Gerstenberg <me@joahg.com>
@joahg
joahg requested a review from a team as a code owner July 27, 2026 01:53
wesbillman added a commit that referenced this pull request Aug 5, 2026
## Summary

- admit relay-discovered agents to autocomplete when their response
policy authorizes the viewer
- require authorization in the exact active stream/forum channel for
mentions, while keeping community-wide discovery for member invitation
- fail closed for relay-only agents in DMs and unresolved composer
contexts
- re-authorize cached autocomplete rows after policy/channel changes so
stale agent suggestions cannot leak back in
- preserve managed-agent behavior and explicitly reject stale
agent-marked channel members absent from both live directories

## Validation

- `pnpm --dir desktop test` — 4,288 passed
- `pnpm --dir desktop typecheck`
- `pnpm --dir desktop check`
- `pnpm --dir desktop build:e2e`
- focused Playwright mention matrix — 12 passed
- focused Playwright member-invitation matrix — 2 passed
- pre-push hooks after rebase to current `origin/main` — desktop check
and 4,288 tests passed
- independent correctness/privacy re-review cleared with no remaining
blocker

## Related competing PRs

This supersedes or overlaps #2333, #3056, #4242, #4137, #2314, #4058,
and #2605. This version adds exact-channel authorization, fail-closed
DM/context handling, cached-row reauthorization, forum coverage,
outbound mention-tag coverage, explicit stale-member coverage, and
add-member discovery coverage.

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
@joahg

joahg commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

🤖 Closing as part of Joah's pre-OOO PR triage — stale. Happy to reopen if this is still needed.

@joahg joahg closed this Aug 6, 2026
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.

1 participant