fix(tmux): replace pane-exited with after-kill-pane; enforce width on pane close#40
Open
kanlac wants to merge 2 commits into
Open
fix(tmux): replace pane-exited with after-kill-pane; enforce width on pane close#40kanlac wants to merge 2 commits into
kanlac wants to merge 2 commits into
Conversation
When a pane is killed, tmux redistributes window space and can shrink or grow the sidebar pane. The pane-exited handler already ran to clean up orphaned sidebars, but did not re-enforce the stored sidebar width. Call scheduleClientResizeSync() after the orphan cleanup so the sidebar is snapped back to its configured width, same as on a terminal resize.
pane-exited is silently ignored by tmux 3.4+ — set-hook accepts it without error but show-hooks never lists it and it never fires. As a result, orphaned sidebar cleanup and post-kill width enforcement have never worked on modern tmux. Replace with after-kill-pane, which fires reliably after kill-pane. Also add after-kill-pane to HOOK_NAMES in tmux-sdk so the type is correct and cleanupHooks can unset it on shutdown.
There was a problem hiding this comment.
inspect review
Triage: 5 entities analyzed | 0 critical, 0 high, 4 medium, 1 low
Verdict: standard_review
Findings (1)
- [low] Stale tmux global hook cleanup: cleanupHooks() no longer unsets the previously-used "pane-exited" hook. If an older version installed the "pane-exited" global hook, upgrading to this version will leave it installed, potentially causing duplicate POSTs to /pane-exited (old pane-exited hook + new after-kill-pane hook). Evidence: provider.ts changed from tmux.unsetGlobalHook("pane-exited") to tmux.unsetGlobalHook("after-kill-pane"), with no remaining unset for "pane-exited".
Reviewed by inspect | Entity-level triage found 0 high-risk changes
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
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.
Problem
Two features that were supposed to work after a pane is closed have never actually fired on tmux 3.4+:
Both are broken because they relied on the
pane-exitedhook, which is silently ignored by tmux 3.4+.set-hook -g pane-exited ...returns exit code 0 but the hook never appears inshow-hooksand never fires.Fix
packages/mux/providers/tmux/src/provider.tsReplace
pane-exitedwithafter-kill-pane, which fires reliably after everykill-panecommand on modern tmux. Also updatecleanupHooks()to unset the correct hook name on shutdown.packages/mux/tmux-sdk/src/index.tsAdd
after-kill-panetoHOOK_NAMESso the type is correct.packages/runtime/src/server/index.tsAdd
scheduleClientResizeSync()to the/pane-exitedhandler so sidebar width is enforced after a pane close, not just on terminal resize.Verified on
after-kill-paneappears inshow-hooksand fires correctlypane-exitedno longer appears inshow-hooks(was silently registered before this fix)Test plan
after-kill-paneappears intmux show-hooks -gafter starting the serverpane-exitedno longer appears