Skip to content

Conversation

@tony
Copy link
Member

@tony tony commented Dec 13, 2025

Summary

Adds a regression test documenting the fix for TmuxObjectDoesNotExist being raised when a session is killed while the user is attached via tmuxp load.

User Experience

After running tmuxp load, users would see this traceback printed to their terminal after detaching:

Traceback (most recent call last):
  File "/home/d/.local/bin/tmuxp", line 7, in <module>
    sys.exit(cli.cli())
  ...
  File ".../tmuxp/cli/load.py", line 152, in _load_attached
    builder.session.attach()
  File ".../libtmux/session.py", line 332, in attach
    self.refresh()
  File ".../libtmux/neo.py", line 242, in fetch_obj
    raise exc.TmuxObjectDoesNotExist(...)
libtmux.exc.TmuxObjectDoesNotExist: Could not find object

Root Cause

The issue was caused by libtmux's Session.attach() calling refresh() after attach-session returned. Since attach-session is a blocking interactive command, the session state can change arbitrarily during attachment - including being killed entirely.

Timeline

  • Feb 2024: 9a5147aa - Session.attach() was added with the refresh() call
  • Nov 2025: tmuxp fdafdd2b switched from attach_session() to attach()
  • Users started experiencing the bug

Fix

The fix is in libtmux: tmux-python/libtmux#616

This PR adds a regression test to tmuxp to ensure the behavior is documented and tested.

Test plan

  • Existing tests/cli/test_load.py tests pass (26 passed, 1 skipped)
  • New regression test test_load_attached_handles_session_killed_during_attach passes

Related

Adds a regression test documenting the fix for TmuxObjectDoesNotExist
being raised when a session is killed while the user is attached.

The issue was caused by libtmux's Session.attach() calling refresh()
after attach-session returned. This was fixed in libtmux by removing
the semantically incorrect refresh() call.

Test uses NamedTuple + parametrize + test_id pattern per project style.

Related: libtmux 9a5147aa (introduced bug), tmuxp fdafdd2 (triggered it)
Fix: libtmux PR #616
@tony tony force-pushed the tmuxp-load-exception-bug branch from 9009b86 to b67ee0d Compare December 13, 2025 13:50
@codecov
Copy link

codecov bot commented Dec 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.97%. Comparing base (06f5769) to head (b67ee0d).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1002   +/-   ##
=======================================
  Coverage   72.97%   72.97%           
=======================================
  Files          26       26           
  Lines        1839     1839           
  Branches      347      347           
=======================================
  Hits         1342     1342           
  Misses        394      394           
  Partials      103      103           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tony tony added the bug Something isn't working label Dec 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants