Repository navigation
Description
After returning from inactivity, Session Chat should keep the last messages on screen, avoid flickering through offline, catch up missed messages as soon as HTTP works, and reach live once.
The status bar today goes live → connecting → offline → connecting → live (remembered as "disconnecting"; there is no such label). New messages wait on that last live hop.
Cause
Cold resume always tears down SSE (stop() clears wasConnected). iOS start() always calls stop() first, so every .active is a full reconnect. MessageSync then often runs two authoritative reloads: TransportResumed on Connected, plus a 300ms-debounced server.connected fullReload. Home Sync Probe does not run on foreground; protocol is usually cached.
Related: OPE-119 added Connected-after-drop recovery, which is one of the overlapping reloads.
Approach
Keep last messages visible. Start one REST catch-up as soon as HTTP is usable — do not wait for SSE live. Coalesce reconnect reloads. Do not publish offline while a foreground retry is still in flight. Longer-term: a small Foreground Presence module so lifecycle occupies the connection instead of start/stop, chrome (live) and data catch-up are separate signals, and synthetic reconnect events are not catch-up triggers.
Remaining:
- Stop iOS
start()from tearing down a healthy stream; cancelled tasks must not overwrite Connecting - Do not flash offline on the first SSE retry after resume
- One MessageSync catch-up per resume (coalesce TransportResumed +
server.connected) - Start REST catch-up on occupy/resume, not after live
- Tests for the snapshot trace: cached messages stay, one list fetch before live, no offline hop on a successful resume
Docs: docs/features/foreground-event-stream/ope-165-plan.md
Branch: fix/ope-165-slow-reconnect-after-resume
Imported from Linear OPE-165. Linear status: Done. Priority: High. Created 2026-08-14. Completed 2026-08-15.
Related: OPE-119, OPE-245, OPE-234, OPE-201, OPE-172.
Activity