Resize to the smallest dimensions across all connected writable clients - #2
Merged
Conversation
This was referenced Jul 12, 2026
myobie
added a commit
that referenced
this pull request
Jul 12, 2026
Incident follow-up #2. When cos's `claude --resume` froze on its exit screen, the daemon was left alive+orphaned (ppid=1) needing kill -9. Cause: cleanShutdown awaits server.close() then process.exit() with NO overall deadline. close()'s child-exit wait is internally bounded (~2s), but the outer promise can still hang indefinitely — socketServer.close()'s callback never fires for a lingering/ untracked socket, or eventWriter.flush() stalls — so the daemon never reaches process.exit() and lingers forever. Add a hard deadline (default 5s, PTY_SHUTDOWN_DEADLINE_MS-overridable) armed by cleanShutdown: if the graceful close() hasn't completed by the deadline, the daemon force-exits regardless AND SIGKILLs its child (PtyServer.forceKillChild) so a frozen child isn't left orphaned to init still alive. cleanShutdown is now idempotent too — SIGTERM/SIGINT/onExit/spawner-watchdog can overlap; only the first arms the deadline and drives close(), the rest get the same in-flight promise. Same class as #69/#72 but the frozen-child / stuck-close case. tests/shutdown-backstop.test.ts: a child that traps SIGHUP wedges the graceful path -> backstop force-exits the daemon and reaps the child (timing-independent proof: only the backstop's SIGKILL can kill a SIGHUP-trapping child; the graceful path only ever sends SIGHUP). A normal session still shuts down promptly, well under the deadline. All existing lifecycle tests (spawner-watchdog, kill-wait, exit-event-race, exit-signal, rm-kill-ephemeral, up-down) intact.
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.
📐