From 321e0463771c5666a5fde8fc6c20f958ac544280 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 17:28:20 +0100 Subject: [PATCH] web: settle a leftover replayed turn before the composer checks The previous section can leave the operator's thread marked running from a replayed frame; C8 tests the composer's default state, so it settles once through the page's own fold instead of asserting against leftover state. Found by the post-split gate (the split itself was correct: a fresh open shows Send, no Stop). --- web/test/ui-smoke.mjs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/web/test/ui-smoke.mjs b/web/test/ui-smoke.mjs index f9b56d54..abcd12b4 100644 --- a/web/test/ui-smoke.mjs +++ b/web/test/ui-smoke.mjs @@ -4193,6 +4193,28 @@ try { step("C8/C9: the composer, slash commands and attachments"); await ensureConnected(); await page.waitForSelector("#chatInput", { timeout: 15000 }); + // The previous sections may have left a replayed turn marked running for the + // operator's session. This section tests the composer's default state, so settle + // any such turn once (a real pushed "ended" frame, through the page's own fold) + // rather than asserting against leftover state. + if (await page.evaluate(`!!document.querySelector("#chatStop")`)) { + const settled = await page.evaluate(`(() => { + const ws = window.__pipelinesSocket; + const sessionId = document.querySelector(".chat-row.selected")?.dataset.session ?? ""; + if (!ws || typeof ws.onmessage !== "function" || !sessionId) return false; + ws.onmessage({ data: JSON.stringify({ + type: "chat_event", + chat_event: { session_id: sessionId, kind: "step", step: { status: "ended" } }, + }) }); + return true; + })()`); + if (!settled) throw new Error("C8: could not settle the leftover running turn"); + await eventually(() => page.evaluate(`!document.querySelector("#chatStop")`), { + timeout: 10000, + what: "the leftover turn to settle before the composer checks", + }); + console.log(" settled a leftover running turn before the composer checks"); + } // (a) A draft: the placeholder, Send present and enabled, Stop absent. await page.fill("#chatInput", "A draft from the smoke");