Fix cross-owner relay agent mentions in owner-only builds (#6338)

## Summary

- keep `BUZZ_BUILD_AGENT_ACCESS_OWNER_ONLY` scoped to Desktop-managed
local start and provider deployment boundaries
- stop filtering independently operated relay agents by viewer/owner
equality in native discovery, autocomplete, and send-time revalidation
- preserve NIP-OA ownership verification, owner-authored `respond_to`
policy, shared-channel membership, and fail-closed send-time checks
- replace the packaged-build regression expectation with coverage for
cross-owner allowlisted and `respond_to=anyone` relay agents, including
the emitted agent `p` tag

Fixes #6329.

## Why

The packaged 0.5.17 build reused its managed-runtime owner-only
capability in relay-agent mention admission. That silently hid correctly
configured shared agents owned by another operator, even when their
verified policy explicitly authorized the viewer. The capability is
intended to constrain runtimes Desktop starts or deploys, not external
relay agents.

## Validation

- `pnpm --dir desktop test` (5093 passed)
- `cargo test --manifest-path desktop/src-tauri/Cargo.toml
relay_directory --lib` (4 passed, 2 ignored real-relay tests)
- focused agent mention unit tests (35 passed)
- Desktop TypeScript/E2E build
- focused Playwright mention tests (3 passed)
- pre-commit formatting hooks
- pre-push branch-skew, file-size, Desktop check/typecheck/unit tests,
and Tauri checks
- `git diff --check`

---------

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Carl <c7ebe626f000404285d3686e1dc74cc07cc60a9754a150041ba132e14bd3e2ec@buzz.block.builderlab.xyz>
This commit is contained in:
Wes
2026-08-20 12:35:07 -06:00
committed by GitHub
parent 84c095f8be
commit ee0c7076af
8 changed files with 146 additions and 223 deletions

View File

@@ -1566,7 +1566,9 @@ test("selected relay agents revoked during send emit no p tag", async ({
.not.toContain(ALLOWLIST_RELAY_AGENT_PUBKEY);
});
test("owner-only builds hide other-owned relay agents", async ({ page }) => {
test("owner-only builds admit cross-owner relay agents authorized by allowlist", async ({
page,
}) => {
await installMockBridge(page, {
ownerOnlyAccessBuild: true,
searchProfiles: [
@@ -1580,6 +1582,7 @@ test("owner-only builds hide other-owned relay agents", async ({ page }) => {
relayAgents: [
{
pubkey: ALLOWLIST_RELAY_AGENT_PUBKEY,
ownerPubkey: TEST_IDENTITIES.outsider.pubkey,
name: "quinn",
respondTo: "allowlist",
respondToAllowlist: [MOCK_VIEWER_PUBKEY],
@@ -1589,9 +1592,35 @@ test("owner-only builds hide other-owned relay agents", async ({ page }) => {
});
await page.goto("/");
await page.getByTestId("channel-general").click();
await page.getByTestId("message-input").fill("@quinn");
await page.evaluate(
async ({ channelId, pubkey }) => {
const invoke = window.__BUZZ_E2E_INVOKE_MOCK_COMMAND__;
if (!invoke) throw new Error("Mock bridge is not installed.");
await invoke("add_channel_members", {
channelId,
pubkeys: [pubkey],
role: "bot",
});
await window.__BUZZ_E2E_QUERY_CLIENT__?.invalidateQueries({
queryKey: ["channels"],
});
},
{
channelId: GENERAL_CHANNEL_ID,
pubkey: ALLOWLIST_RELAY_AGENT_PUBKEY,
},
);
const input = page.getByTestId("message-input");
await input.fill("@quinn");
const quinnRow = autocomplete(page).locator("button", { hasText: "quinn" });
await expect(quinnRow).toBeVisible();
await quinnRow.click();
await page.keyboard.type("hello");
await page.getByTestId("send-message").click();
await expect(autocomplete(page)).toHaveCount(0);
await expect
.poll(() => readOutgoingMentionPubkeys(page, "@quinn hello"))
.toContain(ALLOWLIST_RELAY_AGENT_PUBKEY);
});
test("owner-only builds show verified same-owner relay agents", async ({
@@ -1647,13 +1676,23 @@ test("relay-only allowlisted agents stay hidden outside their channel", async ({
await expect(autocomplete(page)).toHaveCount(0);
});
test("relay-only anyone agents are visible when a channel is shared", async ({
test("owner-only builds admit cross-owner relay agents authorized for anyone", async ({
page,
}) => {
await installMockBridge(page, {
ownerOnlyAccessBuild: true,
searchProfiles: [
{
pubkey: ALLOWLIST_RELAY_AGENT_PUBKEY,
displayName: "quinn",
ownerPubkey: TEST_IDENTITIES.outsider.pubkey,
isAgent: true,
},
],
relayAgents: [
{
pubkey: ALLOWLIST_RELAY_AGENT_PUBKEY,
ownerPubkey: TEST_IDENTITIES.outsider.pubkey,
name: "quinn",
respondTo: "anyone",
channelNames: ["general"],