Skip to content

Deliver subscribe overflow recovery as resized snapshot - #5037

Closed
nwparker wants to merge 8 commits into
nwparker/term-speed-2-wake-session-reregisterfrom
nwparker/term-speed-2-subscribe-recovery-kind
Closed

nwparker wants to merge 8 commits into
nwparker/term-speed-2-wake-session-reregisterfrom
nwparker/term-speed-2-subscribe-recovery-kind

Conversation

@nwparker

@nwparker nwparker commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • send the binary terminal.subscribe pending-output-overflow recovery snapshot as kind: 'resized' instead of a second kind: 'scrollback' frame
  • omit the output-byte seq from that wire frame (it is still used server-side for trimming covered pending chunks)
  • skip the recovery snapshot entirely when the serialized snapshot has no output seq (renderer-source fallback), keeping the pre-existing bounded replay instead

Why

The shipped mobile client — the consumer of this stream — unconditionally drops a second scrollback event for an initialized handle, but applies a resized event carrying serialized by re-initializing xterm with fresh scrollback. With the old scrollback kind, the recovery snapshot introduced in #5025 was discarded client-side while the server had already trimmed the pending chunks it covered — making the visible gap strictly larger than the pre-#5025 behavior (which replayed the retained tail). Omitting seq also keeps output-byte sequences out of the client's layout-seq staleness filter.

For renderer-source snapshots there is no output seq, so covered chunks cannot be trimmed exactly — and under backpressure the renderer view may lag the queued chunks, so "serialized later" does not prove coverage. That path now keeps the bounded replay rather than applying an unverifiable snapshot.

Validation

  • Updated recovery test asserts the recovery frame is kind: 'resized', reason: 'pending-output-overflow', with no seq on the wire; new test keeps bounded replay when overflow recovery has no output seq proves the seq-less path replays the retained tail with no recovery frame
  • Both tests fail against the previous server behavior and pass with the fix
  • pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/terminal-subscribe-buffer.test.ts src/main/runtime/mobile-subscribe-integration.test.ts passed: 50 tests, 2 skipped
  • pnpm exec oxlint on touched files passed
  • pnpm run typecheck passed
  • git diff --check passed

Made with Orca 🐋

Co-authored-by: Orca <help@stably.ai>
@nwparker
nwparker force-pushed the nwparker/term-speed-2-wake-session-reregister branch from 4d5410e to 8cc550e Compare June 10, 2026 00:08
@nwparker
nwparker force-pushed the nwparker/term-speed-2-subscribe-recovery-kind branch from 3dffe2f to a4e3001 Compare June 10, 2026 00:08
@ghost

ghost commented Jun 16, 2026 •

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 2 individual chapters for you:

Title
1 Update overflow recovery to use resized frames
2 Verify recovery frame kind and sequence omission
Open in Stage

Chapters generated by Stage for commit e4bbb86 on Jun 17, 2026 9:10am UTC.

@nwparker

Copy link
Copy Markdown
Contributor Author

Closing as superseded by merged PR #7214 (merge e84a8dd), which explicitly revived the complete term-speed-2 model/view chain into current main and then added newer scheduler, producer flow-control, snapshot, and reliability work. This old component/rollup branch no longer has an independent delta to rebase.

@nwparker nwparker closed this Jul 11, 2026
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