Commit 753b35f
committed
🤖 fix: cancel active stream on message edit to prevent history corruption
When editing a compacting message to change parameters (e.g., token count)
while the first compaction is still streaming, the old stream would continue
and corrupt the chat history by replacing everything with [truncated].
Root cause: handleCompletion would find the NEW compaction request in history
and proceed to perform compaction with the OLD stream's partial summary.
Fix: Cancel any active stream before processing edits. This ensures only one
stream runs at a time and aligns with user intent (edit = discard old).
Impact: 9 lines added to agentSession.ts sendMessage method1 parent d307930 commit 753b35f
1 file changed
+9
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
274 | 283 | | |
275 | 284 | | |
276 | 285 | | |
| |||
0 commit comments