Repository navigation
Description
Summary
When a participant joins a room, there is a window between the UI becoming ready and the SSE subscription being established. If another participant sends a chat message during that window, the message can be recovered through the initial SSE snapshot, but the unread badge is never incremented.
This is reproducible through a higher-latency HTTPS reverse proxy. The same upstream test passes over a lower-latency direct connection.
Affected version
- WOOM commit:
37f499a734592d8d29beeb2936d0543d9b92d4b2 - Test browser: Chromium via Playwright
- Media backend: Liveion 0.10.2 (not required to reproduce the chat-state issue)
Reproduction
Use the existing upstream test without modifying it:
E2E_REUSE_SERVER=true \
E2E_BASE_URL=https://<public-https-origin> \
npx playwright test tests/chat.spec.ts:7The test performs these steps:
- Alice creates a meeting.
- Bob joins the meeting.
- Alice immediately sends
hello from alice. - The test expects Bob's
chat-unreadbadge to become1within 15 seconds.
Actual behavior
The test times out waiting for chat-unread. In a full public HTTPS run, 30 of 32 tests passed; this test also failed on repeated runs through two different Cloudflare connector routes, so it is not specific to one proxy path.
A diagnostic run that waits three seconds for Bob's SSE subscription before Alice sends the message shows normal behavior: the SSE connection stays open and the live message arrives in about one second. This points to subscription timing rather than an SSE transport failure.
Expected behavior
The unread state should be correct whether a message is delivered as a live message event or recovered through a snapshot. Reconnecting or receiving a snapshot must not incorrectly clear the badge or double-count old messages.
Analysis
The frontend currently handles the two delivery paths differently:
applySnapshotreplacesmessages.valuewithdata.messages, but does not updateunread(webapp/components/layout.vue, around line 149).- The live
messagebranch appends the message and incrementsunreadwhen chat is closed (webapp/components/layout.vue, around lines 292–294).
Meanwhile, joinRoom becoming visible does not guarantee that openRoomEvents has already acquired its ticket and established the EventSource. A message sent during this interval can therefore arrive in a snapshot instead of the live message branch.
Suggested direction
Reconcile unread state on snapshots as well as on live messages. Ideally, track a last-read message cursor/timestamp or the participant's join/read position, rather than setting unread to the total message count, so historical messages and reconnect snapshots do not create false unread notifications.
Activity
a-wing commentedon Nov 24, 2026
Fixed by #59 (commit 60217bd):
applySnapshotin layout.vue now heals unread state for messages recovered through the initial snapshot — dedupe by message id and count unseen, post-join, non-self messages (ts >= joinAt, with joinAt/ ts both second-resolution). Covered by the recovery e2e specs (run in the SSE transport leg of the matrix; skipped under cable because cable resyncs through the same snapshot path).