Skip to content

Session layer: auto-reconnect, live refresh and stream resume - #2

Merged
retransmit merged 45 commits into
mainfrom
phase-4a2-session-layer
Oct 6, 2026
Merged

retransmit merged 45 commits into
mainfrom
phase-4a2-session-layer

Conversation

@retransmit

Copy link
Copy Markdown
Owner

Summary

Adds a session layer above the transports, so the app survives a lost connection instead of dying silently.

  • Auto-reconnect. One events stream is the liveness signal. When it dies the session reconnects with backoff (1 s doubling to 30 s, five attempts), then offers Retry and Disconnect. A reconnect that does not hold for 30 s counts against the limit, so a daemon that refuses its event stream cannot cause an endless loop.
  • Status strip above every screen. Reconnecting and failed states show wherever the user is, including logs, stats and the terminal.
  • Data stays on screen. Lists, details and the dashboard keep their data through a reconnect and refresh in place. A new connection starts clean. They also refresh from daemon events and when the app returns to the foreground.
  • Streams resume. Logs continue from the exact line where they stopped, with no gap and no duplicates. Stats keep their history. A terminal ends cleanly and offers "New session".
  • Background handling. Streams and pending refreshes stop in the background and resume on return.
  • Connections screen. A "Connecting to X... Cancel" bar, connect errors under the profile, and "Save & Connect" hands the connect to the list. Leaving Home ends the session.
  • SSH host keys. A mismatch during a reconnect fails the session and never trusts silently.

Fixes along the way

  • TLS streams cancelled before their headers arrive now release the connection.
  • The System dashboard is no longer refetched while another tab is showing.
  • The logs tail menu's "All" option works.
  • A finished action closes its own screen rather than whatever is on top.

Test plan

  • flutter analyze clean
  • flutter test 639 passing, including whole-app tests over a real session on fake daemons
  • Manual check on a device: lose and regain the network on each transport with logs, stats and a terminal open
  • Manual check on a device: background the app for several minutes and return
  • SSH through a reconnect with logs open against a real sshd

@retransmit
retransmit merged commit a8f02db into main Oct 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant