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:
2026-08-29 17:27:04 -04:00
parent 6bf7f456d4
commit 1a60ecbd8b
186 changed files with 1738 additions and 7796 deletions
+8 -5
View File
@@ -188,8 +188,10 @@ def test_partial_answer_survives_sources_nav_midstream(
bubble = page.locator(".msg.brain .bubble").last
expect(bubble).to_contain_text(FIRST_LINE_DOM, timeout=30_000)
# The turn is still in flight (the stream runs ~9s; navigation takes
# well under that).
expect(page.locator("#send-btn")).to_be_disabled()
# well under that) — phase 48: the in-flight button is the enabled
# Stop control, not the old disabled busy state.
expect(page.locator("#send-btn")).to_be_enabled()
expect(page.locator("#send-label")).to_have_text("Stop")
# THE BUG REPORT, VERBATIM: click "Sources" while chat is generating.
page.click("#nav-sources")
@@ -257,9 +259,10 @@ def test_no_orphan_brain_message_when_navigated_before_first_token(
thinking = page.locator(".msg.brain").last.locator("details.thinking")
thinking.wait_for(state="attached", timeout=10_000)
expect(thinking.locator(".thinking-text")).to_contain_text(THINKING_TAIL)
# Still pre-token: the button is busy with the Thinking state.
expect(page.locator("#send-btn")).to_be_disabled()
expect(page.locator("#send-label")).to_have_text("Thinking…")
# Still pre-token: the button is the enabled Stop control (phase 48 —
# the old disabled "Thinking…" busy state is gone).
expect(page.locator("#send-btn")).to_be_enabled()
expect(page.locator("#send-label")).to_have_text("Stop")
# Leave during the pause (no answer token has streamed — acc is empty,
# so the pagehide save point must persist nothing brain-side).