Reapply "fix: isolate chat SSE broadcasts per generation"

This reverts commit 46f1f042b0.
This commit is contained in:
gsxdsm
2026-05-05 08:21:33 -07:00
parent 46f1f042b0
commit 41375736e7
6 changed files with 267 additions and 39 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix chat: after stopping a streaming reply, the next message would appear sent but show no Stop button or "Connecting…" indicator. The cancellation broadcast from the previous generation was leaking into the new SSE subscription, immediately marking it as errored. Each `chatManager.sendMessage` now allocates a per-generation id; `ChatStreamManager` only delivers tagged broadcasts to subscribers from the matching generation, and `sendMessage`'s cleanup no longer deletes a newer generation's `activeGenerations` slot when an older one finally unwinds.