fix: terminal clear, detach, log replay, self-attach, and umask bugs#29
Open
s85io wants to merge 2 commits intomobydeck:mainfrom
Open
fix: terminal clear, detach, log replay, self-attach, and umask bugs#29s85io wants to merge 2 commits intomobydeck:mainfrom
s85io wants to merge 2 commits intomobydeck:mainfrom
Conversation
…nal state leak ESC c (RIS) resets the entire terminal state (fonts, colors, modes), which leaks host terminal settings into the attached session. Use CSI H + CSI 2J + CSI 3J instead to clear screen and scrollback without resetting terminal configuration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Send MSG_DETACH packet to master before exiting on detach keypress - Seek to last SCROLLBACK_SIZE bytes when replaying large session logs - Move connect_socket before self-attach check so stale env vars from dead sessions don't block new attaches - Handle ENOENT separately from replay path for clearer error messages - Restore umask on every error path in create_socket, not just success Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Collection of bug fixes for attach/detach lifecycle and master socket creation:
\033[999H\r\n(move-to-bottom) instead of full terminal reset.SESSION_ENVVARfrom a dead session would block new attaches. Now we connect first and only then check for loops. Also closes the socket on self-attach detection.umask(omask)was only called on the success path; failures inbind/listen/setnonblocking/chmodleft the process umask changed to 077.Test plan
make clean && make && sudo cp atch /usr/bin/atch)list -ashows it as exited, re-attach replays log tail🤖 Generated with Claude Code