Skip to content

fix(tmux): wrap sidebar spawn in sh -c for fish shell compatibility and protect daemon with nohup - #65

Open
vishal4meena wants to merge 1 commit into
Ataraxy-Labs:mainfrom
vishal4meena:fix/posix-sidebar-command-compatibility
Open

vishal4meena wants to merge 1 commit into
Ataraxy-Labs:mainfrom
vishal4meena:fix/posix-sidebar-command-compatibility

Conversation

@vishal4meena

Copy link
Copy Markdown

Problem

When tmux has default-shell set to Fish (or another non-POSIX shell), opening the sidebar (prefix + o -> s or prefix + o -> t) causes the sidebar pane to open for a fraction of a second and immediately disappear.

Root cause:

  1. opensessions-server generates the following command string for tmux split-window:
    OPENSESSIONS_SESSION_NAME=... OPENSESSIONS_WINDOW_ID=... REFOCUS_WINDOW=... exec "${OPENSESSIONS_DIR:-.}"/apps/tui/scripts/start.sh
  2. Because tmux runs shell commands passed to split-window via $default-shell -c "<command>", tmux delegates execution directly to Fish.
  3. Fish syntax does not support POSIX command-prefix environment variables (VAR=val cmd) or POSIX parameter default expansions (${VAR:-default}). Fish immediately fails with:
    fish: ${ is not a valid variable in fish.
    
  4. The pane process exits with code 127, tmux flags the pane as dead, and the opensessions pane-died hook promptly cleans up the dead pane.
  5. Additionally, ensure_server in server-common.sh backgrounded the server binary without nohup, leaving the background process vulnerable to SIGHUP when the invoking subshell closes.

Solution

  1. Wrap sidebar command in sh -c: In packages/runtime-rs/src/tmux_provider.rs, wrap the spawn command string in sh -c '...' and escape single quotes in session and window identifiers. This guarantees execution through POSIX /bin/sh regardless of the user's default-shell.
  2. Add nohup in server-common.sh: Launch opensessions-server with nohup to prevent SIGHUP termination.

Verification

  • Tested locally in tmux with Fish shell as default-shell on macOS.
  • Verified that both focus (prefix o s) and toggle (prefix o t) reliably spawn the sidebar, resize cleanly, maintain WebSocket connection, and stash/close on toggle.
  • Ran cargo test -p opensessions-runtime (all 21 unit tests pass) and cargo test -p opensessions-sidebar-core (all 29 unit tests pass).

- Wrap spawn_sidebar command in sh -c '...' so split-window works when
  tmux default-shell is fish or other non-POSIX shells
- Escape session name and window id in sidebar spawn command
- Use nohup when launching opensessions-server in ensure_server to protect
  background daemon from SIGHUP

@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: 3 entities analyzed | 0 critical, 0 high, 3 medium, 0 low
Verdict: standard_review

Findings (0)


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

@rs545837

rs545837 commented Oct 6, 2026

Copy link
Copy Markdown
Member

we are not actively maintaining this project anymore, but you can find out a lot of cool things happening at herdr. Check that out.

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.

3 participants