Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 49 additions & 4 deletions tests/bugbash/repros/editAfterEmptyFailedReply.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -21,10 +22,54 @@ 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);
// 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"
: (await stopBusy.isVisible())
? "stop in progress"
: (await sendFailed.isVisible())
? "refused"
: "";
const deadline = Date.now() + 20_000;
await composer.fill(followUp);
for (;;) {
Comment thread
ThomasK33 marked this conversation as resolved.
Resolved
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);
// 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");
Expand Down
Loading