Repository navigation
fix(terminal): deliver batched output when a paired view pauses, so its queries get answered - #33749
Merged
Merged
Conversation
…ts queries get answered Main yields a chunk's query replies to a receiving remote view at ingestion. If that view paused while the chunk was still in the 5 ms output batcher, the pause flushed it into the paused gate and dropped it, so a fish DA1 went unanswered and fish stalled 10 s. Flush the batcher before applying the pause; the desktop's hidden-pane path already answers queries in bytes that arrive after it paused. Refs #32944
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 4 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
1 task done
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.
ELI5
When you switch away from a paired-server terminal, the desktop tells the host to stop sending output for it. A few bytes can still be waiting in the host's 5 ms send buffer at that moment. The host was throwing those bytes away. If they held fish's "what terminal are you?" question (DA1), nothing ever answered it, and fish froze for 10 s and printed
fish could not read response to Primary Device Attribute query. Now the host sends those buffered bytes before it pauses, so the desktop sees the question and answers it.Root cause
#33273 made the host's own responder answer queries while a remote view is paused. It decides who answers once, when the chunk is ingested (
shouldAnswerQueriesForLiveChunk→hasRemoteReceivingOutput). If the view is receiving at that moment, the host stays silent and the view owns the reply.The chunk then waits in the multiplex output batcher (
terminal-output-batcher.ts, 5 ms timer, often longer under load). TheSetOutputPausedhandler setoutputPaused = truefirst and only then flushed the batcher. The flushed bytes went into the paused gate (queueOrSendOutput) and were dropped. So no one answered them: the host had already handed the reply to the view, and the view never got the bytes. #33273's PR lists this as known gap 1.Trace from a failing run on
main(host-side instrumentation, not committed):What changed
terminal-multiplex-slot-frames.ts: on pause, flush the output batcher before settingoutputPaused, so already-ingested bytes reach the view.shouldSkipHiddenRendererOutput→skipHiddenRendererOutput→writeHiddenStartupRendererQueries), which answers stateless queries such as DA1. Live traces showed that path answering these late bytes.Each query is still answered exactly once. The host yielded these bytes to the view at ingestion, and now the view gets them.
Verification
--servehost and a paired desktop client, with isolated profiles, hidden windows andORCA_BACKGROUND_LAUNCH=1. It ran a scratch Playwright spec that is not checked in. Scenario: the desktop opens a new terminal tab in the server workspace, then switches to another tab after about 150 ms. A host-side 300 ms delay onSetOutputPausedemulated SSH latency.main: 1/5 and 1/10 warned; failing traces show the batcher drop above.main: a CLI-created background terminal with no client (0/2); with a paired client viewing the workspace (0/5); with the workspace inactive (0/5); a visible desktop tab (0/5).terminal-multiplex-paused-output-drop.test.tsnow asserts that output batched when the pause lands, including a DA1, is delivered and no drop notice is sent. It fails onmain, passes here.pnpm tc,pnpm test src/main/runtime/rpc(395 files, 4027 tests), andpnpm run check:code-quality:changedpass.Known remaining gap (not fixed here)
In the remaining failures, the DA1 was ingested while the new stream was still buffering before its first snapshot. The host sent it after the snapshot (not covered, seq 83 > snapshot seq 0), and the desktop's binary controller received the frame. It never reached the query branches of
live-data-callback.ts, though: no hidden-skip, restore-queue drain, restore-queue clear, or salvage path logged it. So the desktop drops it earlier in its live-data path, while the newly created pane is still attaching and its first restore is in flight. Candidates are the reattach live-data deferral queue (deferredReattachLiveData), post-restoredrop-duplicatereconciliation, and the hidden ordered-seq filter. None of these salvage queries. It needs its own fix and is tracked as a follow-up.Compatibility / risk
orcad_update_terminals_running).Refs #32944 (reporter @bengry; follow-up to #33273).
Agent skill upstream boundary