feat(dashboard): spawn claude in new tmux window when $TMUX is set #48

Closed
didericis wants to merge 1 commits from tmux-spawn-window into main
Owner

Summary

Option 3 from docs/research/claude-code-pane-in-dashboard.md, opt-in by environment. When the dashboard runs inside tmux (\$TMUX is set), both the new-agent (n) attach AND the re-attach (Enter) paths spawn claude with tmux new-window -n <slug> docker exec -it … claude … instead of taking over the terminal via curses.endwin. The dashboard keeps rendering in its current tmux pane; the operator switches to the new window via tmux's normal nav (default C-b n).

Outside tmux, the existing handoff path is unchanged — the dispatch is a single _in_tmux() check per attach.

Mechanics

  • DockerBottle.claude_docker_argv extracted from exec_claude, so both subprocess.run AND tmux new-window can build on the same docker-exec argv (preserving --append-system-prompt-file).
  • _attach_via_tmux in dashboard.py wraps the docker argv with tmux new-window -n <slug> … and returns immediately. Status line: [slug] opened in new tmux window.
  • _build_tmux_attach_argv split out as a pure helper so the wrapping shape is unit-tested without shelling out.

Status

  • 467 unit tests pass (2 new for _build_tmux_attach_argv)
  • No regression for the non-tmux path; existing handoff used when \$TMUX is unset
## Summary Option 3 from `docs/research/claude-code-pane-in-dashboard.md`, opt-in by environment. When the dashboard runs inside tmux (`\$TMUX` is set), both the new-agent (`n`) attach AND the re-attach (Enter) paths spawn claude with `tmux new-window -n <slug> docker exec -it … claude …` instead of taking over the terminal via `curses.endwin`. The dashboard keeps rendering in its current tmux pane; the operator switches to the new window via tmux's normal nav (default `C-b n`). Outside tmux, the existing handoff path is unchanged — the dispatch is a single `_in_tmux()` check per attach. ## Mechanics - `DockerBottle.claude_docker_argv` extracted from `exec_claude`, so both `subprocess.run` AND `tmux new-window` can build on the same docker-exec argv (preserving `--append-system-prompt-file`). - `_attach_via_tmux` in dashboard.py wraps the docker argv with `tmux new-window -n <slug> …` and returns immediately. Status line: `[slug] opened in new tmux window`. - `_build_tmux_attach_argv` split out as a pure helper so the wrapping shape is unit-tested without shelling out. ## Status - 467 unit tests pass (2 new for `_build_tmux_attach_argv`) - No regression for the non-tmux path; existing handoff used when `\$TMUX` is unset
didericis added 1 commit 2026-05-26 14:05:07 -04:00
feat(dashboard): spawn claude in new tmux window when \$TMUX is set
test / unit (pull_request) Successful in 18s
test / integration (pull_request) Successful in 1m10s
62ceab7485
Option 3 from `docs/research/claude-code-pane-in-dashboard.md`,
opt-in by environment. When the dashboard runs inside tmux
(\$TMUX is set), both the new-agent (`n`) attach AND the
re-attach (Enter) paths spawn claude with
`tmux new-window -n <slug> docker exec -it … claude …` instead
of taking over the terminal via `curses.endwin`. The dashboard
keeps rendering in its current tmux pane; the operator switches
to the new window via tmux's normal nav.

Outside tmux the existing handoff path is unchanged — the
dispatch is a single `_in_tmux()` check per attach.

Mechanics:

  - `DockerBottle.claude_docker_argv` extracted from `exec_claude`,
    so both subprocess.run AND `tmux new-window` can build on the
    same docker-exec argv (preserving `--append-system-prompt-file`).
  - `_attach_via_tmux` in dashboard.py wraps the docker argv with
    `tmux new-window -n <slug> …` and returns immediately. Status
    line: `[slug] opened in new tmux window`.
  - `_build_tmux_attach_argv` split out as a pure helper so the
    wrapping shape is unit-tested without shelling out.

467 unit tests pass (2 new for `_build_tmux_attach_argv`).
didericis closed this pull request 2026-05-26 14:16:59 -04:00
Some checks are pending
test / unit (pull_request) Successful in 18s
test / integration (pull_request) Successful in 1m10s

Pull request closed

Sign in to join this conversation.