test(app): verify submission settlement across reconnect

Keep submission acknowledgement separate from turn liveness: disconnect preserves the running turn until authoritative catch-up. Wait for confirmed running chrome before exercising queued cancellation so the alternate-send shortcut cannot race turn startup.
This commit is contained in:
Mohamed Boudra
2026-09-05 14:47:58 +02:00
parent 4a14d1bacc
commit 1add8de9c7
@@ -5,6 +5,7 @@ import {
expectAgentIdle,
expectAgentReadyToInterrupt,
expectAgentSurfacesIdle,
expectInlineWorkingIndicator,
expectRunningAgentChrome,
expectVisibleAgentSurfacesIdle,
} from "../support/helpers/agent-stream";
@@ -549,9 +550,18 @@ async function expectProviderAcknowledgementBeforeRpcAcceptanceSettlesSubmission
const userMessage = await submitMessageWithImage(page, prompt);
await gate.waitForHeldServerMessage();
await gate.waitForAgentStreamItem("user_message");
await gate.waitForAgentStreamEvent("turn_started");
gate.releaseHeldServerMessage();
await expect(userMessage).toHaveAttribute("aria-busy", "false");
await gate.drop();
await expect(page.getByTestId("turn-working-indicator")).toHaveCount(0);
await expectInlineWorkingIndicator(page);
await expect(userMessage).toHaveAttribute("aria-busy", "false");
await agent.client.waitForFinish(agent.agentId, 30_000);
gate.setServerMessageSuppressed("agent_status", false);
gate.setServerMessageSuppressed("agent_update", false);
gate.restoreFresh();
await expectVisibleAgentSurfacesIdle(page);
await expect(userMessage).toHaveAttribute("aria-busy", "false");
} finally {
gate.restore();
@@ -991,7 +1001,7 @@ test.describe("Agent message submission", () => {
await openAgentRoute(page, agent);
await expectComposerVisible(page);
await submitMessage(page, "Keep running until the queued turn is ready.");
await expectAgentReadyToInterrupt(page);
await expectRunningAgentChrome(page, title);
await queueMessage(page, secondPrompt);
await expect(page.getByRole("button", { name: "Send queued message now" })).toBeVisible();