fix(profiles): connection-profile switch re-dials the WebSocket (#888)

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-12 23:27:08 +03:00
1 parent 546bd17b18
commit 683a24becf
10 files changed
+183 -17

No files matched your search

@@ -576,6 +576,16 @@ class ChatViewModel(
resetSessionState(sessionId = null, title = "Hermes", isLoading = true)
}
}
// Same wipe when the CONNECTION profile changes (different server):
// without it, gateway.ready on the re-dialed socket tries to resume
// the OLD server's session on the NEW server and fails (split-brain
// after connection-profile switch, reproduced live 2026-08-12).
viewModelScope.launch {
ProfileSwitchCoordinator.connectionSwitched
.collect { _ ->
resetSessionState(sessionId = null, title = "Hermes", isLoading = true)
}
}
// Slash-command usage ranking (issue #865): mirror the local usage
// counts into state so the autocomplete can surface most-used
// commands first. Best-effort — the store never throws.