fix: resync clients on broadcast lag (audit round 3, P4) - #27
Merged
Conversation
When a client's broadcast receiver overflowed, both forwarders logged the RecvError::Lagged and continued, so a dropped GridDiff left the screen corrupt until the next unrelated FullRefresh. Add Session::focused_window_full_refresh, which rebuilds a FullRefresh for every pane in the focused window, and call it from both forwarders on lag: - IPC forwarder (session_dispatch): replay each pane's current grid to the client, capturing the sessions Arc + session name into the task. - WebSocket forwarder (ws): same, converted to text for xterm.js. Also update the audit report with the implementation status. Tested: focused_window_full_refresh_covers_every_pane (ignore-gated like the other PTY-spawning tests). cargo test / clippy -D warnings / fmt --check green. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
Coverage reportGenerated by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses finding P4 from the round 3 audit (docs/plans/audit-round3-2026h2.md).
Problem
Both broadcast forwarders handled
RecvError::Laggedby logging and continuing.tokio::sync::broadcastdrops the oldest messages on overflow, so when a slow or remote client fell behind, droppedGridDiffmessages left the terminal permanently corrupt until an unrelated FullRefresh happened to arrive.Fix
Session::focused_window_full_refresh()rebuilds aFullRefreshfor every pane in the focused window.session_dispatch.rs): onLagged, replay each pane's current grid to the client. Captures the sessionsArcand session name into the forwarder task.ws.rs): same recovery, converted to text for xterm.js.Disconnect during replay ends the forwarder cleanly.
Tests
focused_window_full_refresh_covers_every_pane: oneFullRefreshper pane, correct dimensions.#[ignore]-gated like the other PTY-spawning tests in this crate (they hang on interactive shell close in CI); runnable locally with--ignoredon Linux/macOS.cargo test -p nexterm-server(267 passed),cargo clippy --all-targets -- -D warnings,cargo fmt --checkall green.Notes
Remaining findings (P3, C2, P5–P7, S1 (LOW), R5/A5) stay tracked in the audit report for a later pass; the report's implementation-status section is updated here.