fix(#99): gate tool and clarify events by session id to prevent leaks (#168)

This commit is contained in:
M57 authored and GitHub committed 2026-06-20 17:27:34 +03:00
1 parent 6cb4e17882
commit 74714fc1df
4 files changed
+56 -3

No files matched your search

@@ -160,6 +160,7 @@ class ChatViewModel(
is WsEvent.ToolComplete -> handleToolComplete(event)
is WsEvent.ClarifyRequest -> {
if (!isCurrentSession(event.sessionId)) return
_uiState.update {
it.copy(
clarifyRequest =
@@ -369,6 +370,7 @@ class ChatViewModel(
// ── Tool events ──────────────────────────────────────────────────────
private fun handleToolStart(event: WsEvent.ToolStart) {
if (!isCurrentSession(event.sessionId)) return
var orphanToPersist: ChatMessage? = null
val sessionId = _uiState.value.currentSessionId
@@ -409,6 +411,7 @@ class ChatViewModel(
}
private fun handleToolComplete(event: WsEvent.ToolComplete) {
if (!isCurrentSession(event.sessionId)) return
var completedTool: ChatMessage? = null
_uiState.update { state ->