Skip to content

fix(test): unlink throwaway tmux socket in tmux-integration teardown (stop leaking tgctl-test-* sockets)#37

Merged
alex-mextner merged 1 commit into
mainfrom
fix/tgctl-tmux-socket-leak
Jun 17, 2026
Merged

fix(test): unlink throwaway tmux socket in tmux-integration teardown (stop leaking tgctl-test-* sockets)#37
alex-mextner merged 1 commit into
mainfrom
fix/tgctl-tmux-socket-leak

Conversation

@alex-mextner

Copy link
Copy Markdown
Owner

Problem

tests/ctl-tmux-integration.test.ts runs every test against a private -L tgctl-test-<pid> server and tears it down in afterAll with tmux kill-server. On macOS, kill-server ends the server process but does NOT unlink the socket file under /tmp/tmux-<uid>/. The socket inode leaked every run.

This is the same bug as rig-cli's e2e fixture (alex-mextner/rig-cli#31). Together they leaked ~185 tgctl-test-*/rigtest-* sockets into /private/tmp/tmux-501/ on the dev machine, which once starved/killed the live tmux server.

Fix

  • afterAll now kills the server AND rmSyncs its socket file.
  • The path is computed by a small socketPathFor() helper that mirrors tmux's server_create_socket (TMUX_TMPDIR honored only when absolute, else /tmp) and is reused by the new regression test.

Test

Adds teardown leaves no leaked tmux socket file: boots a real server, asserts the socket file exists, runs the same kill+unlink, asserts the file is gone.

Verified: full bun test suite green (1015 pass), and the tmux integration suite leaves zero tgctl-test-* sockets behind in both the default and TMUX_TMPDIR-set environments.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de044e33d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/ctl-tmux-integration.test.ts Outdated
…teardown (no leaked tgctl-test-* sockets)

The ctl-tmux integration suite ran every test against a private
-L tgctl-test-<pid> server and tore it down in afterAll with
`tmux kill-server`. On macOS, kill-server ends the server PROCESS but
does NOT unlink the socket file under /tmp/tmux-<uid>/. The socket inode
therefore leaked every run; alongside rig-cli's identical bug, ~185
tgctl-test-*/rigtest-* sockets piled up in /tmp/tmux-501/ and once
starved/killed the developer's live tmux server.

Fix: afterAll now kills the server AND rmSync's its socket file. The path
is computed by socketPathFor(), which mirrors tmux's server_create_socket
(TMUX_TMPDIR honored only when absolute, else /tmp) and is reused by the
new regression test.

Adds a regression test ("teardown leaves no leaked tmux socket file"):
boots a real server, asserts the socket file exists, runs the same
kill+unlink, asserts the file is gone. Verified the suite leaves zero
tgctl-test-* sockets behind in both default and TMUX_TMPDIR-set envs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alex-mextner alex-mextner force-pushed the fix/tgctl-tmux-socket-leak branch from de044e3 to b20af56 Compare June 17, 2026 11:52
@alex-mextner alex-mextner merged commit 708bac7 into main Jun 17, 2026
8 of 9 checks passed
@alex-mextner alex-mextner deleted the fix/tgctl-tmux-socket-leak branch June 17, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant