Tmux & orphan sessions
How muxbay isolates every session on tmux -L purple, detects unattached orphan sessions, and lets you attach or clean them safely.
Every terminal and agent tab in muxbay runs inside an isolated tmux server so sessions stay alive across browser refreshes, network drops, and device switches. Sometimes — after a crash, manual tmux command, or workspace change — a tmux session keeps running on disk without any tab pointing to it. muxbay surfaces these orphan sessions and lets you recover or clean them up safely.
The isolated purple socket
muxbay never touches your personal ~/.tmux.conf or default tmux server:
- Dedicated socket:
tmux -L purple - Custom config:
src/config/tmux.conf(prefix key disabled, status bar hidden, mouse enabled) - Tab sessions: named
pt-{wsId}-{paneId}-{tabId}and tracked in~/.purplemux/workspaces/{wsId}/layout.json - Shared GPTWork Codex sessions: named
pt-gptwork-*and discovered from GPTWork manifests (owned externally by GPTWork; closing a shared tab never kills GPTWork's session)
What is an orphan tmux session?
An orphan is a live session running on the purple tmux socket (listDetailedSessions()) that is not attached to any active tab in any workspace layout and is not an external GPTWork session.
Common causes:
- A server crash or forced restart before a tab cleanup completed.
- Creating a session manually with
tmux -L purple new-session. - Removing or editing a
layout.jsonfile while shells were still running.
Detecting & managing orphans in the UI
Switch the sidebar to the SESSIONS tab (click Sessions at the top of the sidebar, or press ⌘⇧B / Ctrl+Shift+B):
- When orphan sessions exist, the SESSIONS tab shows an amber badge with the exact count.
- Inside the Sessions panel, the Orphan tmux section lists each unattached session with its session name, working directory, and process info.
From there, you have three actions:
| Action | What it does |
|---|---|
| Attach | Binds the orphan tmux session into a new tab in your active (or selected) workspace and navigates straight to it — nothing is lost |
| Kill | Terminates that single orphan tmux session immediately |
| Clean all | Opens a confirmation dialog and terminates all unattached orphan sessions in bulk |
409 Conflict safety guard
The backend (/api/system/tmux-sessions) cross-checks every session against all workspace layouts before killing it. If a session is actually attached to an active tab, DELETE returns 409 Conflict and refuses to kill it — preventing accidental loss of active work.
HTTP API & CLI inspection
You can also inspect the purple socket directly from your shell:
# List all sessions on the isolated muxbay socket
tmux -L purple list-sessions
Or via the server API:
GET /api/system/tmux-sessions— returnsattachedCountand theorphansinventory.POST /api/system/tmux-sessions— attaches a specified orphan session into a workspace tab.DELETE /api/system/tmux-sessions— kills one orphan or cleans all unattached orphans (protected by the409active-tab guard).
What's next
- Save & restore layouts — how active tabs survive browser closes and server restarts.
- Workspaces & groups — moving live tabs between workspaces via
tmux rename-session. - Architecture — how
node-pty, WebSockets, andtmux -L purplefit together.