Skip to content

Install tmux hooks into a fixed array slot to coexist with other plugins - #56

Open
ndom91 wants to merge 1 commit into
Ataraxy-Labs:mainfrom
ndom91:fix/tmux-hook-array-index
Open

ndom91 wants to merge 1 commit into
Ataraxy-Labs:mainfrom
ndom91:fix/tmux-hook-array-index

Conversation

@ndom91

@ndom91 ndom91 commented Jul 21, 2026

Copy link
Copy Markdown

tmux hooks are arrays. Setting a hook without an array index (e.g. set-hook -g after-select-window '...') replaces the entire array, silently wiping any elements other plugins installed at different indices. Because the daemon re-runs setup_hooks on session events, this clobbered other plugins' hooks after they had loaded.

Route every hook through a fixed array slot (HOOK_INDEX) so opensessions only ever touches its own slot. This coexists with other plugins' hooks and is idempotent on re-run (overwrites the same slot rather than appending duplicates, as set-hook -ga would). uninstall.sh likewise now unsets only our slot instead of the whole array.

tmux hooks are arrays. Setting a hook without an array index (e.g.
`set-hook -g after-select-window '...'`) replaces the ENTIRE array,
silently wiping any elements other plugins installed at different
indices. Because the daemon re-runs setup_hooks on session events, this
clobbered other plugins' hooks after they had loaded — e.g. a window
renamer whose after-select-window hook stopped firing.

Route every hook through a fixed array slot (HOOK_INDEX) so opensessions
only ever touches its own slot. This coexists with other plugins' hooks
and is idempotent on re-run (overwrites the same slot rather than
appending duplicates, as `set-hook -ga` would). uninstall.sh likewise
now unsets only our slot instead of the whole array.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@inspect-review inspect-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inspect review

Triage: 4 entities analyzed | 0 critical, 0 high, 3 medium, 1 low
Verdict: standard_review

Findings (0)


Reviewed by inspect | Entity-level triage found 0 high-risk changes

Xubbbb added a commit to Xubbbb/opensessions that referenced this pull request Sep 13, 2026
…line fixes

- Spawn the sidebar with a fixed `sh -c '...'` launcher and pass per-pane
  values through `split-window -e`, so a fish (or any non-POSIX)
  default-shell no longer kills the pane on start (Ataraxy-Labs#46/Ataraxy-Labs#54/Ataraxy-Labs#60).
- Install every hook in array slot 90210 and remove only entries we wrote
  (matched by content, so pre-slot index-0 entries are cleaned up), instead
  of replacing whole hook arrays and wiping other plugins' hooks (Ataraxy-Labs#56).
- Use `=name:` / `=name` targets for per-session commands: tmux resolves a
  bare `-t <session>` as a window of the current session first, so
  sessions named `1` or `api` returned another session's panes (F021).
- Width-repair pipeline: skip stacked/zoomed sidebars and windows too narrow
  for the target width, which re-fired after-resize-pane forever (F022);
  use only `$(...)` substitutions because tmux expands `$name` while
  parsing hooks, and install it through the escaping wrapper.
- Pane-exit hooks repair width synchronously before notifying the server in
  the background, so kill-pane returns with the sidebar already fixed.
- Dead-pane sweep only touches windows that host a sidebar (F023); hiding a
  sidebar releases the window's remain-on-exit with `-u` (F025).
- Hook bodies carry `$N` session ids instead of names, which can contain
  quotes or `|` (F024); loopback curls use `--noproxy '*'` (F004).
- Detect agent panes by whole-word alias match, not substring (F028).
- New provider hooks: `nudge_dead_panes` works around tmux <= 3.5a losing
  SIGCHLD for exiting panes (tmux #4559, utempter builds), `mux_server_id`
  lets the server notice a replaced tmux server, `resolve_session_id`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hzd3jyw4o4E9QdNVAXHKQQ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant