fix: replace same-socket client roles explicitly - #147
Merged
Conversation
This was referenced Jul 31, 2026
schickling-assistant
force-pushed
the
schickling-assistant/2026-07-31-explicit-client-role-transitions
branch
from
July 31, 2026 19:42
138b6c6 to
e0903c2
Compare
schickling-assistant
force-pushed
the
schickling-assistant/2026-07-31-explicit-client-role-transitions
branch
from
July 31, 2026 19:46
e0903c2 to
2c865a5
Compare
schickling-assistant
marked this pull request as ready for review
July 31, 2026 19:52
…ent-role-transitions
Contributor
Author
|
Merged after fresh combined-tree Nix and Vitest proof. Thank you, Nathan, for pushing us to make role replacement and synchronization generation behavior explicit — the contract is much cleaner now. 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 socket that sent
PEEKstayed read-only after a later validATTACH. The server installed the requested size and started a fresh screen synchronization, but continued ignoringDATAandRESIZEand excluded the socket from shared-grid negotiation.Closes #152.
What
Treat every valid
ATTACHandPEEKas a complete replacement of the same-socket client role.ATTACHnow clears read-only state before installing geometry and renegotiating; malformedATTACHpayloads still leave role and synchronization state untouched.The integration tests cover both transitions symmetrically, prove input and resize behavior, and cover malformed
ATTACHfrom both prior roles. The protocol contract and changelog document the replacement semantics.Rationale
Role is one per-socket state, not independent sticky flags. Replacing it at the already-validated role-message boundary keeps role, requested geometry, synchronization generation, input authorization, and resize participation coherent without adding a second state machine.
Proof
main1c625c7PEEK -> ATTACHdid not restoreDATAnpm run build: passednpm run typecheck: passedgit diff --check origin/main...HEAD: passed2c865a5Posted on behalf of @schickling
agent_nameagent_session_idagent_toolagent_tool_versionagent_runtimeagent_modelruntime_profileskills_manifestworktreemachinetooling_profile