fix(queue): re-read the server queue after a stream gap

- Add `resync()` to the message queue store: re-reads the server
  snapshot once a hydration has established server ownership.
- Call it from the sync provider's stream-reconnect and transport-switch
  handlers.
- Re-read the server session after a failed take.
- Keep a queue a newer broadcast produced when a hydration snapshot
  predates it, listed in the snapshot or not.
- Document the broadcast transports and the resync in the stores and
  message-queue docs.
This commit is contained in:
Ibrahim Khan
2026-09-09 07:30:50 +00:00
parent 458dcf78c0
commit 8e7c26be23
5 changed files with 89 additions and 20 deletions
@@ -140,7 +140,11 @@ allowlists.
Every mutation broadcasts `openchamber:message-queue.updated` with
`{ revision, session }` to all connected clients (SSE and WS), so several
devices on one server see one queue. The session in that payload always names
devices on one server see one queue. "SSE" here is the notification stream
at `/api/notifications/stream`. The event pipeline's SSE fallback at
`/api/global/event` is a plain proxy of OpenCode's stream and carries no
`openchamber:*` events, so a UI on that transport re-reads the snapshot when
its stream reconnects instead. The session in that payload always names
its `directory`, including the broadcast that removes the last item: the UI
keys its projection by directory, and a broadcast without one left the
delivered message on screen (a session's directory is remembered until the