Reconnect without a silent gap
Reconnect from the last locally committed checkpoint, not the last received batch or the last ACK in a log.
Normal reconnect
- Fence handlers from the old connection before they can update the new state.
- Receive a new
hello, validate stream/history and authenticate. - Send
subscribewith the same consumer/subscription IDs and exact filter, usingstart.mode: "resume"and the saved token unchanged. - Validate the accepted
subscribedbinding. ACKs now use its generation and the new connection ID. - Apply replay through the ordinary idempotent reducer, then continue live after the checkpoint and
caught_upat the cut.
For committed checkpoint C=42 and cut H=47, replay scans (42,47]. Even when no events match, the checkpoint reaches the cut. Do not wait for a trade before saving progress.
Crash boundaries
Server ACK persistence can lag behind client state. A valid saved token does not depend on the server having persisted its ACK. Normal live sends are not stop-and-wait, but finite unacknowledged windows can close a slow session.
When retry is insufficient
cursor_mismatch requires restoring the exact binding or explicitly choosing another start. reset_required means continuity cannot be guaranteed. Preserve the token and resolve the gap explicitly; do not silently delete it and choose live_cut.
For retryable overload, use finite backoff with the same committed token. Limit attempts/time and watch the retention boundary. Retryability does not promise unlimited history.
Durable state recovery does not make external trading actions exactly-once. Those actions need their own idempotency and reconciliation. See retention/reset and errors.
