fix(chat): send omit_messages=true on session.resume (issue #842) (#844)

The gateway replays the full transcript over a new socket on
session.resume unless omit_messages is set; mobile hydrates history via
REST in parallel, so the replay is redundant. When a reconnect lands
mid-stream, the replayed message gets a fresh UUID and dedup can't
collapse the 90% orphan with the 100% replay (different ids + content),
leaving a duplicate bubble. Desktop already sends omit_messages: true;
mirror that in both resume paths (ChatViewModel + NotificationReplyReceiver)
and pin it in the exact-map test verifies.

Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
M57andM57 authored and GitHub committed 2026-08-07 22:21:16 +03:00
1 parent 1f0916ad05
commit e854559de4
4 files changed
+16 -6

No files matched your search

@@ -306,7 +306,11 @@ class NotificationReplyReceiverTest {
Thread.sleep(500)
verify {
HermesWsClient.request(WsMethods.SESSION_RESUME, match { it["session_id"] == "session-abc" }, any())
HermesWsClient.request(
WsMethods.SESSION_RESUME,
match { it["session_id"] == "session-abc" && it["omit_messages"] == true },
any(),
)
HermesWsClient.request(
WsMethods.PROMPT_SUBMIT,
match { it["session_id"] == "runtime-session-abc" },
@@ -642,7 +642,7 @@ class ChatViewModelTest {
verify {
HermesWsClient.send(
WsMethods.SESSION_RESUME,
mapOf("session_id" to "session-from-notification"),
mapOf("session_id" to "session-from-notification", "omit_messages" to true),
any(),
)
}
@@ -1271,7 +1271,13 @@ class ChatViewModelTest {
.isEmpty(),
)
verify { HermesWsClient.send(WsMethods.SESSION_RESUME, mapOf("session_id" to "session-456"), any()) }
verify {
HermesWsClient.send(
WsMethods.SESSION_RESUME,
mapOf("session_id" to "session-456", "omit_messages" to true),
any(),
)
}
}
@Test
@@ -1894,7 +1900,7 @@ class ChatViewModelTest {
verify {
HermesWsClient.send(
WsMethods.SESSION_RESUME,
mapOf("session_id" to "session-456"),
mapOf("session_id" to "session-456", "omit_messages" to true),
any(),
)
}