Skip to content

Reduce terminal reconnect replay cost with snapshot-first progressive scrollback #146

@danshapiro

Description

@danshapiro

current behavior

When reconnecting or refreshing a terminal-based pane, Freshell replays full terminal output keystroke-by-keystroke.

For long-running commands this is slow, data-heavy, and delays useful content.

expected behavior

On reconnect or refresh, users should see the final rendered screen first, then recent context, with older history loaded on demand.

proposed direction

Implement progressive terminal hydration:

  1. send current rendered screen first
  • Return the latest screen snapshot immediately so the pane is usable quickly.
  1. send recent scrollback next
  • Stream a bounded recent window after first paint (for example a few screens).
  1. lazy-load older history
  • Load additional scrollback only when user scrolls up near the loaded boundary.
  1. optional server-side coalescing
  • Where possible, coalesce replay into line-level or frame-level state on the server before sending.

acceptance criteria

  • Initial reconnect/refresh displays final screen state before bulk history arrives.
  • Initial payload size is substantially smaller than full replay for large histories.
  • Additional history is fetched incrementally as user scrolls up.
  • Existing terminal correctness is preserved for prompt state and visible text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions