feat(chat): stop an in-flight answer — Send becomes Stop, the partial is kept and persisted, the model stream is torn down
This commit is contained in:
@@ -365,10 +365,16 @@ def _submit(page: Page, question: str) -> None:
|
||||
|
||||
|
||||
def _wait_settled(page: Page) -> None:
|
||||
"""The turn is complete: answer text in the bubble, button recovered."""
|
||||
"""The turn is complete: answer text in the bubble, button recovered.
|
||||
|
||||
Phase 48: the label assertion carries the settle wait with an
|
||||
explicit timeout — the in-flight button is the enabled Stop control
|
||||
(never disabled), so ``to_be_enabled`` no longer blocks until the
|
||||
turn settles, and Playwright expect's default (5s) does not inherit
|
||||
the page default."""
|
||||
expect(page.locator(".msg.brain .bubble").last).not_to_have_text("", timeout=30_000)
|
||||
expect(page.locator("#send-btn")).to_be_enabled(timeout=30_000)
|
||||
expect(page.locator("#send-label")).to_have_text("Send")
|
||||
expect(page.locator("#send-label")).to_have_text("Send", timeout=30_000)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@@ -403,13 +409,14 @@ def test_multi_read_turn(
|
||||
done = next(f for f in frames if f.get("type") == "done")
|
||||
assert done["deflected"] is False
|
||||
|
||||
# The transient "calling tool" states, recorded deterministically:
|
||||
# the label shows "Calling tool…" and #send-status walked through
|
||||
# The transient "calling tool" states, recorded deterministically.
|
||||
# Phase 48 (owner-locked): the in-flight button is the Stop control —
|
||||
# the label holds "Stop" for the whole turn (it no longer relabels
|
||||
# to "Calling tool…"), and #send-status walked through
|
||||
# "… is listing documents" then "… is reading <sp>" for BOTH reads,
|
||||
# in order.
|
||||
labels = page.evaluate("() => window.__labels")
|
||||
assert "Calling tool…" in labels, labels
|
||||
assert labels.index("Calling tool…") > labels.index("Thinking…")
|
||||
assert "Stop" in labels, labels
|
||||
statuses = page.evaluate("() => window.__statuses")
|
||||
i_list = next(
|
||||
(i for i, s in enumerate(statuses) if "is listing documents" in s), None
|
||||
|
||||
Reference in New Issue
Block a user