Skip to content

Commit 37441ee

Browse files
steveyeggeclaude
andcommitted
fix(tmux): stop daemon from creating separate socket server
When not inside tmux ($TMUX unset), InitRegistry() was setting the tmux socket to the sanitized town name (e.g., "-L gt"), creating a separate tmux server. Daemon-spawned sessions (deacon, witnesses, refineries) ended up on this socket while user-spawned sessions (crew) lived on the default server. Sessions couldn't see each other; prefix-n/p only cycled within one socket. Fix: when not inside tmux, leave the socket unset so tmux uses its default server. Session names already include rig prefixes (hq-deacon, gt-witness, bd-crew-tom) so there's no collision risk. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 70743bc commit 37441ee

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

internal/session/registry.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515

1616
"github.com/steveyegge/gastown/internal/config"
1717
"github.com/steveyegge/gastown/internal/tmux"
18-
"github.com/steveyegge/gastown/internal/workspace"
1918
)
2019

2120
// PrefixRegistry maps beads prefixes to rig names and vice versa.
@@ -114,18 +113,16 @@ func InitRegistry(townRoot string) error {
114113

115114
// Set tmux socket for session discovery.
116115
// If we're inside tmux, parse the socket from $TMUX (e.g. /tmp/tmux-501/default,pid,idx)
117-
// so we query the same server our session lives on. Otherwise, fall back to the town
118-
// name for multi-instance isolation when spawning new tmux servers.
116+
// so we query the same server our session lives on. When not inside tmux
117+
// (e.g., daemon process), leave the socket unset so tmux uses its default
118+
// server — the same one the user's interactive sessions live on.
119+
// Session names already include rig prefixes (hq-deacon, gt-witness, etc.)
120+
// so there's no collision risk on the default server.
119121
if tmuxEnv := os.Getenv("TMUX"); tmuxEnv != "" {
120122
// $TMUX format: /path/to/socket,server_pid,session_index
121123
if socketPath, _, ok := strings.Cut(tmuxEnv, ","); ok && socketPath != "" {
122124
tmux.SetDefaultSocket(filepath.Base(socketPath))
123125
}
124-
} else {
125-
townName, err := workspace.GetTownName(townRoot)
126-
if err == nil && townName != "" {
127-
tmux.SetDefaultSocket(sanitizeTownName(townName))
128-
}
129126
}
130127

131128
r, err := BuildPrefixRegistryFromTown(townRoot)

0 commit comments

Comments
 (0)