Skip to content

Improve built-in terminal reliability and remote replay performance - #1076

Open
Diffuzmetall wants to merge 1 commit into
get-bb:mainfrom
Diffuzmetall:bb/ide-3-4-terminal-reliability
Open

Improve built-in terminal reliability and remote replay performance#1076
Diffuzmetall wants to merge 1 commit into
get-bb:mainfrom
Diffuzmetall:bb/ide-3-4-terminal-reliability

Conversation

@Diffuzmetall

Copy link
Copy Markdown

Closes #1075.

Summary

  • batch raw PTY output into ordered chunks and preserve arbitrary UTF-8/binary bytes end to end
  • add bounded browser and daemon websocket backpressure, bad-socket isolation, heartbeat/reconnect, input queuing, and sequence deduplication
  • reconnect from the last received sequence and bound initial browser replay to the latest 512 KiB instead of replaying the full 4 MiB scrollback on every open
  • serialize terminal restart, open the replacement before closing the old PTY, and wait for daemon exit acknowledgement so final output precedes exit
  • keep threadless terminal caches current, make latest-attached clients own resize, and restore ownership on failed attach/detach
  • enable xterm Unicode 11 width rules and Nerd Font fallbacks
  • bump the host-daemon protocol from 75 to 76 for byte-preserving input and required bounded-replay fields

Measurements

Sustained output

A local 16 MiB output probe improved from about 6.5 MiB/s to 53–63 MiB/s. Websocket output messages dropped from 16,386 to 258–480 depending on PTY chunking.

Input remained responsive during a 16 MiB remote flood. Over the Tailscale path used for QA, the full burst completed without disconnect while a concurrent input echo returned in 101 ms.

Reopening a populated remote terminal

Measured through an SSH tunnel to a patched VPS:

Before After
Time to final replayed line 2,210 ms 556 ms
Replay bytes 4,192,407 461,853
Websocket output messages 1,025 15

A subsequent reconnect requested the previous nextSeq and replayed only 319 bytes rather than the retained history.

Input integrity

A 200,009-byte payload containing emoji and combining characters crossed multiple 64 KiB request boundaries on the VPS with an exact SHA-256 match. CLI --stdin also has coverage for invalid UTF-8 bytes.

Validation

On current main:

  • pnpm exec turbo run typecheck for app, CLI, host daemon, host-daemon contract, server, SDK, server contract, and templates
  • 191 focused tests across app terminal UI/transport/controller, CLI terminal commands, daemon connection/PTY manager, server hub/routes, and both contracts
  • production builds for app, CLI, server, and host daemon
  • patched local and VPS live stacks, including latency, flood/backpressure, atomic restart, large paste, replay truncation, reconnect, and multi-client resize ownership

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.

Built-in terminal is slow to reopen and unreliable under sustained output

1 participant