Repository navigation
Description
Summary
Several changes queued across 0.71.0 to 0.74.0 alter undocumented or accidental libtmux behaviors that downstream callers and test suites rely on in practice. Roughly two thirds of surveyed libtmux dependents declare no upper version bound, so an unannounced behavior change reaches them on upgrade. This roadmap supplement slates auditing each candidate so downstream de facto usage gets at least one warning release (starting in 0.71.0 for promoted existing-server and handle-reuse tracks, and 0.72.0 for daemon-version cuts), an escape hatch across a multi-release transition where warranted, and either a documented migration path or a stabilized de jure public API (such as raises=False returning [] instead of raising) when the old behavior serves a real use case.
Motivation
Three transitions already follow a two-release FutureWarning to enforcement schedule: bare Server() ignoring inherited $TMUX (0.71.0 -> 0.72.0 in #961, #962), {Session, Window, Pane}.__exit__() preserving unowned handles (0.71.0 -> 0.72.0 in #963, #964), and < 3.3a connected-daemon list queries raising exc.VersionTooLow instead of returning [] or False (0.72.0 -> 0.73.0 in #965, #966).
Auditing the rest of the 0.71.0 to 0.74.0 queue against tmuxp (v1.84.0) and public dependents surfaces gaps that a bare bugfix-versus-breaking split misses. Some deprecations fire before a public replacement exists (pytest -Werror suites fail immediately when pointed at libtmux._internal.*), unit tests commonly stub .cmd() with loose mock objects that omit returncode == 0, string-formatting and semicolon-escaping fixes alter outputs silently, and some inventory pollers deliberately want non-raising list reads ([]) rather than catching exceptions around every property access.
Evidence
Server.attached_sessions filter fix (#949, 0.71.0)
In v0.70.0 (458a4ef), server.py#L1145-L1158 calls filter(session_attached__noeq="1"), where OpNotFound(ValueError) is caught by except ValueError: inside QueryList.filter() and evaluates to [] for 0, 1, or N attached clients. The queued fix returns a QueryList[Session] of sessions whose session_attached count is non-zero, and QueryList remains a list subclass. Zero surveyed dependents rely on Server.attached_sessions returning [], so this fix is low risk and can ship in 0.71.0 without a warning.
Pane.send_keys(), Pane.enter(), and Server.new_session() exit-status checks (#948, #951, 0.71.0)
In v0.70.0, pane.py#L1015-L1020, pane.py#L1840-L1846, and server.py#L3316-L3326 inspect only proc.stderr, whereas #948 and #951 raise exc.LibTmuxException whenever proc.returncode != 0. Real tmux_cmd instances always populate an int returncode, while send_keys and new_session are the two most-called methods across dependents and unit tests that stub .cmd() with unittest.mock.MagicMock(stderr=[]) or types.SimpleNamespace(stdout=[...], stderr=[]) expose a truthy MagicMock or missing .returncode attribute. Before cutting 0.71.0, audit whether returncode checks should require isinstance(proc.returncode, int) (or emit a one-release warning on non-int mock attributes) versus enforcing strict tmux_cmd return attributes immediately.
libtmux.common.get_version() and get_version_str() deprecation (#965, 0.72.0)
In v0.70.0, get_version() and get_version_str() parse tmux -V without warning and expose .cache_clear() via functools.lru_cache. In #965 (0.72.0), both functions emit DeprecationWarning directing callers to private libtmux._internal.support.server_version(server), even though public Server.capabilities() does not ship until 0.74.0 (#739). Downstream callers such as tmuxp v1.84.0 call get_version_str() with no server running, call get_version() during plugin initialization, and clear .cache_clear() in test_cli.py. Before 0.72.0 warns, decide whether client-binary version lookup is de jure and stabilize a public helper alongside Server.capabilities() so no warning points users at _internal or breaks pytest -Werror suites without a public migration target.
Pinned downstream call sites in tmuxp v1.84.0
From tmux-python/tmuxp@e250218:
src/tmuxp/plugin.py lines 10 and 222:
from libtmux.common import get_version
...
self.tmux_version = get_version()src/tmuxp/cli/debug_info.py lines 15 and 135:
from libtmux.common import get_version_str, tmux_cmd
...
"tmux_version": get_version_str(),tests/cli/test_cli.py lines 62-67:
libtmux.common.get_version.cache_clear()
try:
with pytest.raises(SystemExit):
cli.cli(["ls"])
finally:
libtmux.common.get_version.cache_clear()Pane.__repr__() and str(pane) shortening (#950, 0.71.0)
In v0.70.0, pane.py#L2817-L2819 resolves self.window and self.session to render Pane(%1 Window(@1 1:..., Session($1 ...))), spawning two tmux clients per call and raising exc.TmuxObjectDoesNotExist if inspected after teardown. Queued #950 (0.71.0, promoted alongside safe handle reuse) renders Pane(%1) directly from stored pane_id. Static transcripts such as tmuxp/README.md and external doctests or snapshot assertions matching Window(@ or Session($ inside repr(pane) will stop matching, so 0.71.0 should document the format change in MIGRATION and evaluate whether an opt-in verbose formatter or transitional escape hatch is warranted.
Server.set_buffer() and Pane.paste_buffer() trailing-semicolon escaping (#953, 0.72.0; #881, 0.74.0)
In v0.70.0, server.py#L2699-L2705 passes buffer_name and data unescaped to tmux, while #953 (0.72.0) and #881 (0.74.0) apply escape_trailing_separator() to buffer names, payloads, and paste separators. Any caller that previously hand-escaped a trailing semicolon as "foo\\;" to work around tmux command-separator parsing would store a literal backslash ("foo\\;") once library escaping lands. Before 0.72.0, check public dependents for "\\;" workarounds in set_buffer and paste_buffer calls and document the change in MIGRATION alongside 0.64.0's #845 escaping note.
Two-release enforcement cuts (#961 to #962 and #963 to #964 in 0.71.0 to 0.72.0; #965 to #966 in 0.72.0 to 0.73.0)
In v0.70.0, bare Server() inherits $TMUX, {Session, Window, Pane}.__exit__() kills looked-up handles, and < 3.3a list properties return []. Each surface emits FutureWarning for one minor release (0.71.0 for #961 and #963, 0.72.0 for #965) before enforcing -L default, kill_on_exit=False, and exc.VersionTooLow in the next release (0.72.0 and 0.73.0). Scripts running inside tmux -L (Server.from_env()), test suites using with session: (kill_on_exit=True), and lenient inventory pollers each need a verified warning plus filter recipe, an explicit keyword or environment escape hatch where warranted, and a decision on whether non-raising list reads stay supported through an explicit parameter such as raises=False.
Proposal
Gate behavior-shifting items across 0.71.0 to 0.74.0 on four checks before each release is cut:
- Emit
FutureWarningorDeprecationWarningfor at least one minor release (0.71.0or0.72.0ahead of the corresponding default flip) before changing any observable runtime behavior relied on in the wild beyond dead-code bugs like#949, paired withwarnings.filterwarnings,[tool.pytest.ini_options], andPYTHONWARNINGSrecipes inMIGRATION(docs(contributing): Add breakage graduation policy and PR comparison #970). - Ship a public replacement ahead of (or alongside) every deprecation warning so no warning message points callers to
libtmux._internal.*, including deciding whether querying the clienttmuxbinary onPATHwithout a running server (tmuxp debug-info) warrants a public helper alongsideServer.capabilities(). - Provide temporary escape hatches where callers cannot update call sites in one step, evaluating keyword arguments (
kill_on_exit=True,Server.from_env()), environment or constructor toggles across a multi-release window, andisinstance(proc.returncode, int)narrowing or a transitional warning for mock.cmd()stubs in#948and#951. - Stabilize de jure public parameters where downstream callers legitimately want the prior behavior as part of the contract, such as evaluating
raises: bool = ...(raises=Falsereturning[]instead of raising on unsupported or unreachable daemons, complementingcheck=TrueonPane.capture_pane()in Distinguish blank pane captures from failed reads #952 andhas_session_strict()in Confirm exact session absence before removing saved state #955).
Alternatives
Shipping all behavior changes directly in 0.71.0 and 0.72.0 without mock-stub guards, public replacements for _internal hints, or lenient opt-out parameters would avoid carrying transitional branches and deprecation machinery. That approach breaks uncapped downstream dependents on upgrade: pytest -Werror suites fail as soon as get_version() warns without a public replacement, unit tests stubbing .cmd() with MagicMock(stderr=[]) fail proc.returncode != 0, and inventory pollers lose non-raising list reads with no opt-in parameter. Staging warnings for at least one minor release and promoting legitimate lenient modes into explicit parameters keeps upgrades incremental without freezing accidental bugs forever.
References
- Release sequencing roadmap: 0.63.x and beyond Roadmap #907
- Lifecycle conflicts and ordering roadmap: Lifecycle roadmap: overlaps, conflicts, blockers and tmux version gates #925
- Consolidated roadmap: [Agentic DX] libtmux: consolidated roadmap (core + async + engines) #629
- Breakage graduation policy and PR comparison template: Document API breakage graduation and behavioral PR comparison #969 (docs(contributing): Add breakage graduation policy and PR comparison #970)
Activity