-
Notifications
You must be signed in to change notification settings - Fork 112
fix(Session.attach()): Remove refresh() call that fails after session killed
#616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+114
−2
Conversation
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
2 tasks
043074b to
f844569
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #616 +/- ##
==========================================
+ Coverage 45.24% 45.39% +0.15%
==========================================
Files 22 22
Lines 2250 2249 -1
Branches 360 360
==========================================
+ Hits 1018 1021 +3
+ Misses 1089 1082 -7
- Partials 143 146 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6c80021 to
3415a70
Compare
why: Reproduce tmuxp issue #1002 where attach() raises exception if session is killed while user is attached. what: - Add test that simulates session killed during attach-session - Mark as xfail since attach() currently calls refresh() which fails - Documents expected behavior: attach() should not raise if session gone
557784a to
70d1383
Compare
…illed why: attach-session is a blocking interactive command where session state can change arbitrarily during attachment, including being killed entirely. Calling refresh() after such a command is semantically incorrect. what: - Remove self.refresh() call from Session.attach() Fixes: tmux-python/tmuxp#1002
why: The fix in the previous commit resolves the issue, so the test should now pass and serve as a permanent regression guard. what: - Remove xfail marker from test_session_attach_does_not_fail_if_session_killed_during_attach
Session.attach()): Remove refresh() call that fails after session killed
tony
added a commit
that referenced
this pull request
Dec 14, 2025
why: Document the bug fix and behavioral change for the upcoming release. what: - Add bug fix entry for #616 (attach no longer fails if session killed) - Add breaking change note that attach() no longer calls refresh()
tony
added a commit
that referenced
this pull request
Dec 14, 2025
why: Document the bug fix and behavioral change for the upcoming release. what: - Add bug fix entry for #616 (attach no longer fails if session killed) - Add breaking change note that attach() no longer calls refresh()
4af426b to
1c31e04
Compare
tony
added a commit
that referenced
this pull request
Dec 14, 2025
why: Document the bug fix and behavioral change for the upcoming release. what: - Add bug fix entry for #616 (attach no longer fails if session killed) - Add breaking change note that attach() no longer calls refresh()
1c31e04 to
1d47867
Compare
why: Document the bug fix and behavioral change for the upcoming release. what: - Add breaking change note that attach() no longer calls refresh() - Add bug fix entry for session killed during attachment
1d47867 to
9826825
Compare
Member
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
tony
added a commit
to tmux-python/tmuxp
that referenced
this pull request
Dec 14, 2025
## libtmux 0.52.1 -> 0.53.0
Bug fix for session attaching
## Bug fix for `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.
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.
Summary
Fixes an issue where
Session.attach()would raiseTmuxObjectDoesNotExistwhen a user:tmuxp loadUser Experience
After running
tmuxp load, users would see this traceback printed to their terminal after detaching:Root Cause
Session.attach()calledself.refresh()after theattach-sessioncommand returned. Sinceattach-sessionis a blocking interactive command, the session state can change arbitrarily during attachment - including being killed entirely.The
refresh()call was semantically incorrect for interactive commands:attach-sessionblocks until user detachesTimeline
Session.attach()was added with therefresh()callattach_session()toattach()Changes
self.refresh()call fromSession.attach()Test plan
tests/test_session.pytests pass (34 passed)test_session_attach_does_not_fail_if_session_killed_during_attachpassestmuxp load, kill session, detach - no exceptionRelated