iw start puts the worktree session on the caller's tmux server, with no way to choose another #685
Labels
No labels
agent-ready
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-human
needs-input
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli#685
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
iw startrun from inside a tmux session creates the worktree's session on that same tmux server — the one named by$TMUX. As a default this is reasonable: a person in tmux gets the new session next to the ones they already have.There is no way to choose another server, and that hurts when the caller's server belongs to something with its own lifecycle.
Where it bit us (procedures, dev machine, 2026-10-02)
claude-rc-home.service, which startstmux -L claude-rc new-session -d -s rc-home …and stops withtmux -L claude-rc kill-server../iw start shared-baseand./iw start email-port. Both worktree sessions landed on theclaude-rcserver.systemctl --user restart claude-rc-homekilled that server, and with it both worktree sessions and the agents running in them. They had nothing to do with the unit.A separate socket on its own does not fix this. A tmux server started from inside the unit sits in the unit's cgroup, so stopping the unit kills it anyway. Moving it out of the unit's lifetime takes something like
systemd-run --user --scope.Ask
Keep the current default. Add an override for which tmux server
iw start/iw openuse, for example:IW_TMUX_SOCKET, passed through astmux -L <name>(or-S <path>);iw openand the dashboard must find a session on whichever server it was created on.Related
iw starton a tmux server that already runs gives the pane that server'sIW_*values. Same root: the session is put on the caller's server.Intake: needs-input
iw-cli already has an
IW_TMUX_SOCKETenvironment variable. When it is set, every tmux call thatiw startandiw openmake gets-L <name>, and that overrides the server named by$TMUX(core/adapters/Tmux.scala:27-36, core/model/Constants.scala:17, docs/api/Tmux.md:26; since commit73db21ed). So the scope of this issue is not clear yet.IW_TMUX_SOCKETexists, what must this issue add? (a) Only user documentation ofIW_TMUX_SOCKETfor this case (for example, set it in the Remote Control unit or the shell). (b) A config key as well as the variable. (c) Something else — please say what..iw/config.conf. (b) User-wide, in a file in the user's home. (c) Both. Also say the order: environment variable over config, or config over environment variable.systemd-run --user --scope tmux -L <name> start-server. (b) iw starts the server itself withsystemd-run --user --scopewhen the server is not running and systemd is present. (c) Out of scope for this issue.iw openand the dashboard must find a session on whichever server it was created on." At the moment eachiwprocess and the dashboard look only at the server their own environment names. Which behaviour is required? (a) Same setting: whoever runsiw openor the dashboard must have the sameIW_TMUX_SOCKETor config (a config key from question 2 makes this automatic). (b) iw records the server for each worktree when it creates the session, andiw openand the dashboard use that recorded server, whatever their own environment says.Answer in a comment on this issue; intake reads it on its next iteration.
Close the issue and remove the label. We can redefine the env var if needed, the premise is wrong.
Intake: fixed by
73db21ed4eThe override this issue asks for exists: with
IW_TMUX_SOCKETset, every tmux call ofiw startandiw opengets-L <name>in place of the caller's$TMUXserver (core/model/Constants.scala:17,core/adapters/Tmux.scala:27-36). The answer on this issue says the premise is wrong and asks to close it; the variable can be redefined in a new issue if needed.