1
0
Fork 0

feat: make tmux-orchestrate work over SSH and forwarded sockets #5

Closed
aleksei wants to merge 1 commit from feat/tmux-orchestrate-ssh into main
Owner

Problem

When pi runs as tmux -> ssh -> pi, $TMUX is not set on the remote host, so
tmux-orchestrate previously stopped with "not inside tmux". There is no tmux
server on the remote side to control either.

Solution

The skill now detects the topology and works in three modes:

  • native — $TMUX points at a live server (local tmux, or a remote tmux you
    are already inside). Behaviour is unchanged: children are windows next to the
    parent.
  • bridged — the local tmux socket is forwarded into the SSH session with
    RemoteForward. The remote agent controls the local tmux over the existing
    connection, so children are local windows that ssh back to the current host
    and keep working in the remote repository. Completion is signalled through a
    marker file, because the child has no bridge.
  • remote — no local tmux is reachable, but this host has tmux. Children run
    in a private tmux -L pi-XXXX server here; the skill prints the attach
    command so the user can watch, and shuts the server down at the end.

A per-run wrapper (~/.pi-tmux) pins -S / -L / the default server, because
exported variables do not survive between tool calls.

Other details:

  • The one-window-per-child model and the explicit random pi-XXXX window names
    are preserved; each child window is pinned with automatic-rename off and
    allow-rename off.
  • Windows and panes are addressed only by @N / %N.
  • Readiness is detected from the π - <cwd> pane title, which also travels
    through ssh.
  • Bridged children reconnect with ClearAllForwardings=yes so they do not
    steal the forwarded socket from the orchestrator.
  • kill-server is allowed only for the private -L server created by the
    orchestration.

Testing

Validated locally with a socket relay: detection for all three modes, the
wrapper, window creation/rename/targeting, title readiness, wait-for,
new-session/kill-server lifecycle of the private server, and the exact
snippets from the skill.

## Problem When pi runs as `tmux -> ssh -> pi`, `$TMUX` is not set on the remote host, so `tmux-orchestrate` previously stopped with "not inside tmux". There is no tmux server on the remote side to control either. ## Solution The skill now detects the topology and works in three modes: - **native** — `$TMUX` points at a live server (local tmux, or a remote tmux you are already inside). Behaviour is unchanged: children are windows next to the parent. - **bridged** — the local tmux socket is forwarded into the SSH session with `RemoteForward`. The remote agent controls the local tmux over the existing connection, so children are local windows that `ssh` back to the current host and keep working in the remote repository. Completion is signalled through a marker file, because the child has no bridge. - **remote** — no local tmux is reachable, but this host has tmux. Children run in a private `tmux -L pi-XXXX` server here; the skill prints the attach command so the user can watch, and shuts the server down at the end. A per-run wrapper (`~/.pi-tmux`) pins `-S` / `-L` / the default server, because exported variables do not survive between tool calls. Other details: - The one-window-per-child model and the explicit random `pi-XXXX` window names are preserved; each child window is pinned with `automatic-rename off` and `allow-rename off`. - Windows and panes are addressed only by `@N` / `%N`. - Readiness is detected from the `π - <cwd>` pane title, which also travels through ssh. - Bridged children reconnect with `ClearAllForwardings=yes` so they do not steal the forwarded socket from the orchestrator. - `kill-server` is allowed only for the private `-L` server created by the orchestration. ## Testing Validated locally with a socket relay: detection for all three modes, the wrapper, window creation/rename/targeting, title readiness, `wait-for`, `new-session`/`kill-server` lifecycle of the private server, and the exact snippets from the skill.
Author
Owner

Reverting: this SSH design is not the desired approach.

Reverting: this SSH design is not the desired approach.
aleksei closed this pull request 2026-11-04 16:07:33 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
zoo/agent-skills!5
No description provided.