fix(desktop): pin activity window navigation

Co-authored-by: Rizz <302abe414ca6e3134763d2539bfcf145aea2a63fe5f8455204ed602fd40cf381@buzz.block.builderlab.xyz>
Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
Taylor Ho
2026-08-24 01:43:13 -07:00
parent 3739bd0136
commit d9392d2573
2 changed files with 28 additions and 8 deletions

View File

@@ -50,6 +50,16 @@ export function useAppNavigation() {
search: { ...next.search, ...companionCoordinates },
}
: next;
if (
companionCoordinates &&
(destination.to !== "/channels/$channelId" ||
destination.params?.channelId !==
companionCoordinates.agentSessionChannel)
) {
return false;
}
const nextLocation = router.buildLocation(destination as never);
if (location.href === nextLocation.href && !behavior.force) {

View File

@@ -3,11 +3,12 @@ import { expect, test } from "@playwright/test";
import { installMockBridge, TEST_IDENTITIES } from "../helpers/bridge";
const AGENT_PUBKEY = TEST_IDENTITIES.tyler.pubkey;
const REPOSITORY_OWNER_PUBKEY = TEST_IDENTITIES.alice.pubkey;
const AGENTS_CHANNEL_ID = "94a444a4-c0a3-5966-ab05-530c6ddc2301";
const GENERAL_CHANNEL_ID = "9a1657ac-f7aa-5db0-b632-d8bbeb6dfb50";
const COMMUNITY_ID = "e2e-default-community";
test("keeps dedicated activity windows connected when opening a channel reference", async ({
test("keeps dedicated activity windows pinned to their original channel", async ({
page,
}) => {
await installMockBridge(page, {
@@ -31,7 +32,7 @@ test("keeps dedicated activity windows connected when opening a channel referenc
() => typeof window.__BUZZ_E2E_SEED_OBSERVER_EVENTS__ === "function",
);
await page.evaluate(
({ agentPubkey, channelId, generalChannelId }) => {
({ agentPubkey, channelId, generalChannelId, repositoryOwnerPubkey }) => {
window.__BUZZ_E2E_SEED_OBSERVER_EVENTS__?.({
agentPubkey,
events: [
@@ -48,7 +49,10 @@ test("keeps dedicated activity windows connected when opening a channel referenc
params: {
update: {
sessionUpdate: "agent_message_chunk",
content: { type: "text", text: "Continue in #general" },
content: {
type: "text",
text: `Continue in #general or open <buzz://repo?owner=${repositoryOwnerPubkey}&d=relay-tools>`,
},
},
},
},
@@ -91,6 +95,7 @@ test("keeps dedicated activity windows connected when opening a channel referenc
agentPubkey: AGENT_PUBKEY,
channelId: AGENTS_CHANNEL_ID,
generalChannelId: GENERAL_CHANNEL_ID,
repositoryOwnerPubkey: REPOSITORY_OWNER_PUBKEY,
},
);
@@ -103,19 +108,24 @@ test("keeps dedicated activity windows connected when opening a channel referenc
name: "Open channel general",
});
await expect(channelReference).toBeVisible();
const activityWindowUrl = page.url();
await channelReference.click();
await expect(page).toHaveURL(
new RegExp(
`#/channels/${GENERAL_CHANNEL_ID}\\?.*community=${COMMUNITY_ID}.*agentSessionChannel=${AGENTS_CHANNEL_ID}`,
),
);
await expect(page).toHaveURL(activityWindowUrl);
await expect(panel).toBeVisible();
await expect(panel).toContainText("Activity · #agents");
await expect(panel).not.toContainText(
"Other channel activity must stay hidden",
);
const repositoryChip = panel.getByRole("button", {
name: "Open repository relay-tools",
});
await expect(repositoryChip).toBeVisible();
await repositoryChip.click();
await expect(page).toHaveURL(activityWindowUrl);
await expect(panel).toBeVisible();
await page.getByTestId("agent-session-settings-menu-trigger").click();
const rawFeedToggle = page.getByTestId("agent-session-toggle-raw-feed");
await expect(rawFeedToggle).toHaveAttribute(