From 7a0939fa4a3f63520cd490d418b1f833858d2722 Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Tue, 27 Oct 2026 01:05:11 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=A4=96=20tests:=20editAfterEmptyFaile?= =?UTF-8?q?dReply=20resends=20after=20a=20stop-in-progress=20refusal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repros/editAfterEmptyFailedReply.e2e.ts | 39 +++++++++++++++++-- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts b/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts index 1b288b77be2..bd0226cccf8 100644 --- a/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts +++ b/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts @@ -3,7 +3,8 @@ // refused the edit once with "History changed". Proves the first Send of such an edit goes through. import { test } from "@e2e-dev/web"; import { expect } from "e2e"; -import { openPlayground, sendMessage, sendMessageForEdit } from "./helpers"; +import { openPlayground, sendMessageForEdit } from "./helpers"; +import { WORKSPACE_STOP_IN_PROGRESS_SEND_BLOCKED_MESSAGE } from "../../../src/constants/agentMessaging"; import { EDIT_HISTORY_CHANGED_MESSAGE } from "../../../src/constants/transcriptBarrier"; test( @@ -21,10 +22,40 @@ test( await screen.getByRole("button", /^Stop/).tap(); await expect(screen.getByText("Auto-retry stopped:")).toBeVisible({ timeout: 10_000 }); - // This send's server drops the empty failed reply from history. + // This send's server drops the empty failed reply from history. "Auto-retry stopped" shows + // before the Stop has settled, and the UI has no signal for that point (the stop latch's + // release): a send in between is refused as retryable (#7655). So send again after each such + // refusal, as its message asks ("retry once it has settled"). Any other refusal fails here. + // The UI should wait for the Stop instead: #7658. const followUp = `6116 follow-up ${stamp}`; - await sendMessage(screen, followUp); - await expect(screen.getByText(`Mock response: ${followUp}`)).toBeVisible({ timeout: 20_000 }); + const composer = screen.getByRole("textbox", "Message"); + const followUpAnswered = screen.getByText(`Mock response: ${followUp}`); + const stopBusy = screen.getByText(WORKSPACE_STOP_IN_PROGRESS_SEND_BLOCKED_MESSAGE); + const sendFailed = screen.getByRole("alert", /^Message Send Failed/); + const outcome = async () => + (await followUpAnswered.isVisible()) + ? "answered" + : (await stopBusy.isVisible()) + ? "stop in progress" + : (await sendFailed.isVisible()) + ? "refused" + : ""; + const deadline = Date.now() + 20_000; + await composer.fill(followUp); + for (;;) { + await screen.getByRole("button", "Send message").tap(); + await expect.poll(outcome, { timeout: Math.max(deadline - Date.now(), 1) }).not.toBe(""); + const seen = await outcome(); + if (seen !== "stop in progress") { + expect(seen).toBe("answered"); + break; + } + await screen.getByRole("button", "Dismiss").tap(); + // Dismissing clears the toast after its fade: a refusal shown before then would go too. + await expect(stopBusy).not.toBeVisible(); + // The refused text comes back into the composer. + await expect(composer).toHaveValue(followUp); + } await edit.tap(); const editBox = screen.getByRole("textbox", "Edit message"); From c56431e3cb246f1c9dfb26210089a83a90ab93da Mon Sep 17 00:00:00 2001 From: Thomas Kosiewski Date: Tue, 27 Oct 2026 01:34:11 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=96=20tests:=20bound=20the=20resen?= =?UTF-8?q?d=20loop,=20match=20any=20error=20toast,=20wait=20for=20the=20r?= =?UTF-8?q?eply's=20stream=20end?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fail once the 20 s deadline passes instead of resending until the global timeout. - Match an error toast by its Dismiss button: an alert has no accessible name. - Wait for the follow-up reply's stream to end before the edit (a mid-stream edit was refused as History changed in 1 of 6 local phone runs). --- .../repros/editAfterEmptyFailedReply.e2e.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts b/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts index bd0226cccf8..7e7aa4854ce 100644 --- a/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts +++ b/tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts @@ -31,7 +31,12 @@ test( const composer = screen.getByRole("textbox", "Message"); const followUpAnswered = screen.getByText(`Mock response: ${followUp}`); const stopBusy = screen.getByText(WORKSPACE_STOP_IN_PROGRESS_SEND_BLOCKED_MESSAGE); - const sendFailed = screen.getByRole("alert", /^Message Send Failed/); + // Any error toast, whatever its title: an alert has no accessible name, and refusal titles + // vary, so match the toast by its Dismiss button. + const sendFailed = screen + .getByRole("alert") + .filter({ has: screen.getByRole("button", "Dismiss") }) + .first(); const outcome = async () => (await followUpAnswered.isVisible()) ? "answered" @@ -55,8 +60,17 @@ test( await expect(stopBusy).not.toBeVisible(); // The refused text comes back into the composer. await expect(composer).toHaveValue(followUp); + // A Stop that never settles must fail here, not resend until the runner's global timeout. + if (Date.now() >= deadline) { + throw new Error("the Stop did not settle within 20 s: every follow-up send was refused"); + } } + // The reply text shows while it still streams. An edit tapped mid-stream was refused as + // "History changed" in 1 of 6 phone runs. This test covers an edit after the reply, so wait + // for the stream to end. + await expect(screen.getByRole("button", "Stop streaming")).not.toBeVisible({ timeout: 20_000 }); + await edit.tap(); const editBox = screen.getByRole("textbox", "Edit message"); const edited = `6116 edited ${stamp}`;