fix(desktop): keep popped activity controls scoped

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 00:39:56 -07:00
parent bd4980a8da
commit 3739bd0136
2 changed files with 48 additions and 3 deletions

View File

@@ -284,12 +284,12 @@ export function AgentSessionThreadPanel({
}
async function handleInterruptTurn() {
if (!channel) {
if (!sessionChannelId) {
return;
}
try {
await cancelManagedAgentTurn(agent.pubkey, channel.id);
await cancelManagedAgentTurn(agent.pubkey, sessionChannelId);
toast.success(
`Stop signal sent to ${agent.name}. It may take a moment to respond.`,
);
@@ -354,7 +354,7 @@ export function AgentSessionThreadPanel({
title={
showRawFeed
? "Hide raw JSON-RPC payloads."
: channel
: sessionChannelId
? "Show raw JSON-RPC payloads for this channel."
: "Show raw JSON-RPC payloads for this agent."
}

View File

@@ -56,6 +56,16 @@ test("keeps dedicated activity windows connected when opening a channel referenc
{
seq: 2,
timestamp: new Date().toISOString(),
kind: "turn_started",
agentIndex: 0,
channelId,
sessionId: "session-original-channel",
turnId: "turn-original-channel",
payload: { source: "channel", triggeringEventIds: [] },
},
{
seq: 3,
timestamp: new Date().toISOString(),
kind: "acp_read",
agentIndex: 0,
channelId: generalChannelId,
@@ -105,5 +115,40 @@ test("keeps dedicated activity windows connected when opening a channel referenc
await expect(panel).not.toContainText(
"Other channel activity must stay hidden",
);
await page.getByTestId("agent-session-settings-menu-trigger").click();
const rawFeedToggle = page.getByTestId("agent-session-toggle-raw-feed");
await expect(rawFeedToggle).toHaveAttribute(
"title",
"Show raw JSON-RPC payloads for this channel.",
);
const stopTurn = page.getByTestId("agent-session-stop-turn");
await expect(stopTurn).toBeEnabled();
await page.evaluate(() => {
const tauri = window.__TAURI_INTERNALS__;
const invoke = tauri?.invoke;
if (!tauri || !invoke)
throw new Error("Mock invoke bridge is unavailable.");
window.__BUZZ_E2E_ACTIVITY_CONTROL_REQUESTS__ = [];
tauri.invoke = async (command, payload) => {
if (command === "build_observer_control_event") {
window.__BUZZ_E2E_ACTIVITY_CONTROL_REQUESTS__?.push(payload);
throw new Error("Control request captured by the E2E test.");
}
return invoke(command, payload);
};
});
await stopTurn.click();
await expect
.poll(() =>
page.evaluate(
() => window.__BUZZ_E2E_ACTIVITY_CONTROL_REQUESTS__?.[0] ?? null,
),
)
.toMatchObject({
agentPubkey: AGENT_PUBKEY,
payload: { type: "cancel_turn", channelId: AGENTS_CHANNEL_ID },
});
await expect(page.locator("body")).not.toBeEmpty();
});