Fix shared agent mentions - #2333
Conversation
Co-authored-by: benclink <111811630+benclink@users.noreply.github.com> Signed-off-by: benclink <111811630+benclink@users.noreply.github.com>
|
Reviewed against The This also preserves the case the alternative #2314 regresses (deleting the pre-filter outright surfaces allowlisted non-member relay agents — details in #2349). And it's the only one of the two with unit + e2e regression coverage. I also confirmed a live external-Hermes repro that this fixes (in #2349). Looks ready on the merits — could this come out of draft so it can get a maintainer review and merge? Thanks for the clean test coverage. |
|
Production repro on 0.5.3 (latest release), and this patch applies cleanly to the Setup — the always-on-Mac-mini topology this PR is for:
Things we tried that do not work, in case it saves someone else the day it cost us:
The last one is worth flagging on its own: while the picker only offers locally-managed agents, a user whose agents live on another machine is pushed toward exactly the workaround that pollutes the channel roster with dead same-named identities (#2648, #3639). The mention path and the duplicate-identity path compound each other. DMs work fine from the laptop throughout, as others have noted — which makes the inconsistency very visible to end users: the same agent is reachable in a DM and unmentionable in a channel it belongs to. Verified this PR against the Also worth confirming from a multi-user angle: this blocks the shared-community story, not just multi-device. A community owner hosting agents for other members can't have those members mention them from Desktop at all — the owner sees the agents, nobody else does. Mobile has no such restriction, so the same person can tag an agent from their phone and not from their Mac. Happy to test a merge candidate on the two-machine setup and report back. |
## 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>
What changed
Root cause
The composer discarded every agent identity outside the current user's managed-agent list before evaluating channel membership and the relay response policy. Shared users therefore saw plain
@Agent Nametext instead of a resolved mention with the agent pubkey tag.User impact
Channel members can discover and mention shared agents that are bot members of the channel. Owner-only and allowlist response policies remain enforced by the existing downstream policy gate.
Validation
just ci