Repository navigation
Description
Summary
Several native tests derive their socket name from a constant string and call kill-server in teardown. Two concurrent test runs for the same case therefore share a server by default.
Reproduction
-
From the tagged
libvtcheckout, install the locked development dependencies withuv sync --frozen --python 3.14 --all-groups --all-extras. Use the checkout root as the working directory. Use tmux 3.4. SetTMUX_BINto its executable if another tmux comes first on your search path. -
Save the following as
case.pyat the checkout root.
import os
from pathlib import Path
import subprocess
import tempfile
import zlib
binary = os.environ.get("TMUX_BIN", "tmux")
name = f"libvt-test-{zlib.crc32(b'tmux-capture')}"
with tempfile.TemporaryDirectory() as tmp:
for shared in (True, False):
paths = [Path(tmp) / ("same" if shared else f"worker-{i}") for i in (0, 1)]
for path in paths:
path.mkdir(exist_ok=True)
def tm(index, *args):
return subprocess.run(
[binary, "-L", name, "-f", "/dev/null", *args],
env=dict(os.environ, TMUX_TMPDIR=str(paths[index])),
capture_output=True, timeout=5, check=False,
)
try:
assert tm(0, "new-session", "-d", "-s", "first", "sleep", "60").returncode == 0
assert tm(1, "new-session", "-d", "-s", "second", "sleep", "60").returncode == 0
assert tm(1, "has-session", "-t", "second").returncode == 0
assert tm(0, "kill-server").returncode == 0
remaining = tm(1, "has-session", "-t", "second").returncode == 0
print("shared" if shared else "separate", "second worker still alive", remaining)
assert remaining is not shared
finally:
for index in (0, 1):
tm(index, "kill-server")- Run the case.
$ uv run --no-sync python case.pyExpected
Each invocation owns its own socket and only tears down its own tmux process.
Actual
Two workers using the live capture test’s socket name can both create sessions. When the first kills its server, the second loses its session. Giving each worker a separate socket directory preserves the second session.
Environment
Tested versions
libvt v0.0.1a4 and trunk 0864aa2, Linux ARM64 on WSL2, tmux 3.4, CPython 3.14.6.
Evidence
Observed output
shared second worker still alive False
separate second worker still alive True
Proposal
Give each test invocation a fixture-owned temporary socket directory or unique absolute socket. Add two overlapping workers and synchronize their teardown in a regression control.
- Developer experience — Developers can run the same tests from multiple worktrees or interpreters without coordinating socket names.
- Immediate benefit — Eliminate process interference from tests exercising a single terminal.
- Longer-term benefit — Make parallel compatibility coverage trustworthy.
- End-user experience — A locally passing change remains reproducible when tests run in parallel.
Activity
tony commentedon Dec 3, 2026
The fix gives each native pane or window test its own short tmux socket. Two concurrent pane captures on tmux 3.6b both completed with distinct sockets, including when one test stopped its server during the other capture. PR #156