happy icon indicating copy to clipboard operation
happy copied to clipboard

Only one `happy` instance works reliably when detached in tmux

Open dzlobin opened this issue 10 months ago • 0 comments

Description

Subsequent instances work while attached but do not receive responses when detached.

Running multiple happy instances simultaneously (e.g., in separate tmux windows) causes all but the first instance to stall. Claude Code stops responding mid-reply when the tmux session is detached. Upon reattaching, it catches up and resumes — but stalls again on the next detach.

Steps to Reproduce

  1. Start happy in tmux window 1 — works fine, survives detach/reattach
  2. Start happy in tmux window 2 (same machine, same directory)
  3. Detach window 2 — window 2 no longer responds in Happy
  4. Reattach — any queued responses land in Happy

Multiple sessions work while attached. Multiple detached sessions do not.

Environment

  • macOS (Apple Silicon)
  • happy-coder (latest via npm)
  • Claude Code latest
  • tmux 3.6
  • Connecting via Eternal Terminal

Expected Behavior

Multiple happy instances should either work concurrently while detached, or the CLI should warn that only one instance is supported at a time.

Actual Behavior

The second instance appears to start normally but stalls when the terminal is detached. No error message is shown.

dzlobin avatar Feb 04 '26 07:02 dzlobin

This looks like a good place to separate three states that can otherwise get conflated:

  • tmux session exists and is detached
  • Happy still has a live route to the intended Claude process
  • that process actually advances after input / remote messages while detached

The failure pattern here sounds like the second or third state is going stale for all but the first instance. I would log session/window/pane, process generation, attached/detached state, and a small post-send receipt: applied / stale / rejected / timeout. That would make the UI say "detached but still consuming" vs "detached and no longer advancing" instead of just "session exists".

I ran into the same product boundary while building Faryo: the phone/browser layer only counts once the action lands back in the same live tmux session, not when the relay accepts it. This v1.0.7 GIF is the proof shape I ended up using:

https://github.com/Snailflyer/faryo/releases/download/v1.0.7/faryo-public-redacted-same-session-handoff-walkthrough-20260528-0120.gif

Snailflyer avatar May 27 '26 23:05 Snailflyer