Skip to content

cmux: tmux subagent panes never attach (respawn-pane no-op) — need eager split-attach #5809

Description

@Yoonkeee

Problem

When running OmO inside cmux (the native-split Terminal layer), tmux subagent panes are created with a placeholder message ("Focus this pane to attach.") but they never transition to an actual opencode attach session, even when the user focuses the pane.

There are two compounding failure modes:

  1. respawn-pane -k is a no-op under cmux __tmux-compat — The activation path in activateFocusedPanes calls activateTmuxPane, which issues a tmux respawn-pane -k <pane_id> command to replace the placeholder with opencode attach. Under cmux, cmux __tmux-compat intercepts all tmux commands and silently discards respawn-pane -k (it has no equivalent native-split operation), so the pane stays on the placeholder forever.

  2. Immediate child-exit on focus — In some cmux configurations, focusing the placeholder pane causes the /bin/sh sleep loop to receive a signal or the pane's shell to terminate, killing the placeholder before any activation occurs. The subagent pane disappears on focus.

Root Cause

The placeholder + focus-to-activate design (buildTmuxPlaceholderCommand + activateTmuxPane respawn) assumes a real tmux server that can reuse an existing pane with respawn-pane -k. cmux emulates tmux's split-window for pane creation but does not implement respawn-pane -k. Consequently:

  • The pane is created (split-window works ✓)
  • The placeholder loop runs (✓)
  • respawn-pane -k to inject opencode attach is silently dropped (✗)
  • The pane remains stuck on the placeholder indefinitely

Proposed Fix

When isCmuxCompatEnvironment() returns true (already exists in packages/tmux-core/src/cmux-detect.ts), skip the placeholder entirely and pass buildTmuxAttachCommand(serverUrl, sessionId, directory) as the initial command to split-window. Simultaneously mark the spawned tracked session with attachActivated: true so the existing activateFocusedPanes guard (if (tracked.attachActivated) continue) skips the respawn attempt automatically.

This is an opt-in, cmux-only path — standard tmux behavior (focus-defer) is unchanged.

Impact

All OmO users running cmux (TMUX contains "cmuxterm" OR CMUX_SOCKET_PATH is set without TMUX) see subagent panes that appear to spawn but never become interactive. The feature is entirely non-functional in this environment.

Environment

  • cmux: 0.64.x (cmuxterm native-split mode)
  • OmO: dev branch
  • Platform: macOS (Apple Silicon), other platforms untested

Relates To

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions