Gate live output until initial screen snapshot - #140
Merged
myobie merged 5 commits intoJul 31, 2026
Merged
Conversation
myobie
force-pushed
the
schickling-assistant/2026-07-31-initial-attach-sync
branch
from
July 31, 2026 11:29
83380ce to
fef0f14
Compare
myobie
marked this pull request as ready for review
July 31, 2026 11:38
Contributor
Author
|
Thank you, Nathan — especially for pushing us to make the snapshot contract precise instead of papering over resize timing. The parser-cut + ordered post-cut queue is a much better foundation for every attached client. Posted on behalf of @schickling
|
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.

Why
A geometry-changing ATTACH delays its SCREEN snapshot for up to 80 ms while the child redraws. The socket currently joins live broadcasts immediately, so DATA or EXIT can arrive before SCREEN. An EXIT during that window is also sent again after SCREEN.
There is an additional parser boundary: xterm processes Terminal.write asynchronously. Merely suppressing a DATA broadcast during the delay can lose it if SCREEN is serialized before xterm parses that write.
What
Treat each ATTACH or PEEK as an initial synchronization phase:
Rationale
The xterm write callback defines an exact cut: every earlier write is represented in SCREEN, while every later broadcast is replayed after SCREEN. node-pty drains PTY data before its public exit event, so a queued EXIT is already ordered after final DATA. An EXIT suppressed before the cut is synthesized after the post-cut queue. This preserves output order and emits exactly one EXIT.
Validation
Current head:
fef0f14CI=1 npm run buildCI=1 npm run typecheckmain/ merged Allow duplicate display names with unambiguous resolution #139: 60 passednpm run verify-docs: 13/13 passedThe tests deterministically hold xterm writes to reproduce parser backlog, verify SCREEN/DATA reconstruction without loss, verify both post-cut and pre-cut EXIT ordering, and cover same-socket pending re-ATTACH plus ATTACH-to-PEEK switching.
Posted on behalf of @schickling
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelruntime_profileskills_manifestworktreemachinetooling_profile