fix(gateway): re-bind session transport to a surviving window on pop-out close - #86039
Open
ayushnangia wants to merge 1 commit into
Open
fix(gateway): re-bind session transport to a surviving window on pop-out close#86039ayushnangia wants to merge 1 commit into
ayushnangia wants to merge 1 commit into
Conversation
Contributor
Author
|
CI note: Python slice 3/12 failed. Local evidence says flake, not this diff: scripts/run_tests.sh tests/test_tui_gateway_server.py -> 554 passed, 0 failed here, and the one test I've seen flake in this file (test_compute_host_turn_end_updates_metadata_mirror) fails intermittently under parallel runs and passes on re-run. This PR's diff only touches _live_session_payload / _close_sessions_for_transport. Worth a re-run before review. |
ayushnangia
force-pushed
the
fix/popout-stream-rebind
branch
from
August 14, 2026 11:28
4c1b535 to
c59455e
Compare
19 tasks
Contributor
fix(gateway): re-bind session transport to a surviving window on pop-out close
|
…out close Live sessions hold one transport; a pop-out window's session.resume rebinds it, and on pop-out close the disconnect path parked the session on the drop sentinel — the original window never received stream events again until a manual re-resume (NousResearch#83716). Sessions now track every transport that has shown them (viewers, stamped in _live_session_payload). _close_sessions_for_transport re-binds to the most recent surviving viewer instead of detaching when one exists; dead viewers are filtered; the drop sentinel + grace reap remain the path for the last viewer. Root cause and repro by CharlesR-sudo on NousResearch#83716.
ayushnangia
force-pushed
the
fix/popout-stream-rebind
branch
from
August 17, 2026 19:35
1ab13a8 to
ba29ce8
Compare
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.
Summary
Fixes #83716: closing a pop-out window strands the session's live stream — the original window never resumes receiving events until a manual re-resume.
Root cause (as diagnosed by @CharlesR-sudo in the issue): live sessions hold a single
transport. A pop-out window'ssession.resumerebinds it to the pop-out's socket; on pop-out close,_close_sessions_for_transportparked the session on the drop sentinel (_detached_ws_transport) and scheduled the orphan reap — nothing re-bound the original window.Changes
tui_gateway/server.py::_live_session_payload: every transport that shows a session is now recorded as a viewer (stamped timestamp), alongside the transport bind.tui_gateway/server.py::_close_sessions_for_transport: on disconnect, the closing transport is removed from the viewers; if a surviving live viewer exists, the session re-binds to the most recent one (dead sockets filtered via_transport_is_dead) and no orphan reap is scheduled. The drop sentinel + grace reap remain the path for the last viewer — single-window behavior is unchanged.Semantics
Validation
scripts/run_tests.sh tests/test_tui_gateway_server.py→ 554 passed, 1 failed — the one failure is the pre-existing flakytest_compute_host_turn_end_updates_metadata_mirror(passes in isolation, untouched by this diff).Root cause credit: @CharlesR-sudo (#83716). Family F member in the stall triage #84047.