fix: Make Mayor/Deacon session names include town name
Session names `gt-mayor` and `gt-deacon` were hardcoded, causing tmux
session name collisions when running multiple towns simultaneously.
Changed to `gt-{town}-mayor` and `gt-{town}-deacon` format (e.g.,
`gt-ai-mayor`) to allow concurrent multi-town operation.
Key changes:
- session.MayorSessionName() and DeaconSessionName() now take townName param
- Added workspace.GetTownName() helper to load town name from config
- Updated all callers in cmd/, daemon/, doctor/, mail/, rig/, templates/
- Updated tests with new session name format
- Bead IDs remain unchanged (already scoped by .beads/ directory)
Fixes #60
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,7 +57,7 @@ Check the current system state:
|
||||
|
||||
```bash
|
||||
# Is Deacon session alive?
|
||||
tmux has-session -t gt-deacon 2>/dev/null && echo "alive" || echo "dead"
|
||||
tmux has-session -t {{ .DeaconSession }} 2>/dev/null && echo "alive" || echo "dead"
|
||||
|
||||
# If alive, what's the pane showing?
|
||||
gt peek deacon --lines 20
|
||||
|
||||
@@ -244,8 +244,8 @@ This is the opposite of polecat work, which is persistent and auditable.
|
||||
|
||||
| Role | Session Name |
|
||||
|------|-------------|
|
||||
| Deacon | `gt-deacon` (you) |
|
||||
| Mayor | `gt-mayor` |
|
||||
| Deacon | `{{ .DeaconSession }}` (you) |
|
||||
| Mayor | `{{ .MayorSession }}` |
|
||||
| Witness | `gt-<rig>-witness` |
|
||||
| Crew | `gt-<rig>-<name>` |
|
||||
|
||||
@@ -376,5 +376,5 @@ But typically just exit and let the daemon respawn you with fresh context.
|
||||
|
||||
State directory: {{ .TownRoot }}/deacon/
|
||||
Mail identity: deacon/
|
||||
Session: gt-deacon
|
||||
Session: {{ .DeaconSession }}
|
||||
Patrol molecule: mol-deacon-patrol (created as wisp)
|
||||
|
||||
@@ -24,14 +24,17 @@ type Templates struct {
|
||||
|
||||
// RoleData contains information for rendering role contexts.
|
||||
type RoleData struct {
|
||||
Role string // mayor, witness, refinery, polecat, crew, deacon
|
||||
RigName string // e.g., "greenplace"
|
||||
TownRoot string // e.g., "/Users/steve/ai"
|
||||
WorkDir string // current working directory
|
||||
Polecat string // polecat name (for polecat role)
|
||||
Polecats []string // list of polecats (for witness role)
|
||||
BeadsDir string // BEADS_DIR path
|
||||
IssuePrefix string // beads issue prefix
|
||||
Role string // mayor, witness, refinery, polecat, crew, deacon
|
||||
RigName string // e.g., "greenplace"
|
||||
TownRoot string // e.g., "/Users/steve/ai"
|
||||
TownName string // e.g., "ai" - the town identifier for session names
|
||||
WorkDir string // current working directory
|
||||
Polecat string // polecat name (for polecat role)
|
||||
Polecats []string // list of polecats (for witness role)
|
||||
BeadsDir string // BEADS_DIR path
|
||||
IssuePrefix string // beads issue prefix
|
||||
MayorSession string // e.g., "gt-ai-mayor" - dynamic mayor session name
|
||||
DeaconSession string // e.g., "gt-ai-deacon" - dynamic deacon session name
|
||||
}
|
||||
|
||||
// SpawnData contains information for spawn assignment messages.
|
||||
|
||||
@@ -22,9 +22,12 @@ func TestRenderRole_Mayor(t *testing.T) {
|
||||
}
|
||||
|
||||
data := RoleData{
|
||||
Role: "mayor",
|
||||
TownRoot: "/test/town",
|
||||
WorkDir: "/test/town",
|
||||
Role: "mayor",
|
||||
TownRoot: "/test/town",
|
||||
TownName: "town",
|
||||
WorkDir: "/test/town",
|
||||
MayorSession: "gt-town-mayor",
|
||||
DeaconSession: "gt-town-deacon",
|
||||
}
|
||||
|
||||
output, err := tmpl.RenderRole("mayor", data)
|
||||
@@ -51,11 +54,14 @@ func TestRenderRole_Polecat(t *testing.T) {
|
||||
}
|
||||
|
||||
data := RoleData{
|
||||
Role: "polecat",
|
||||
RigName: "myrig",
|
||||
TownRoot: "/test/town",
|
||||
WorkDir: "/test/town/myrig/polecats/TestCat",
|
||||
Polecat: "TestCat",
|
||||
Role: "polecat",
|
||||
RigName: "myrig",
|
||||
TownRoot: "/test/town",
|
||||
TownName: "town",
|
||||
WorkDir: "/test/town/myrig/polecats/TestCat",
|
||||
Polecat: "TestCat",
|
||||
MayorSession: "gt-town-mayor",
|
||||
DeaconSession: "gt-town-deacon",
|
||||
}
|
||||
|
||||
output, err := tmpl.RenderRole("polecat", data)
|
||||
@@ -82,9 +88,12 @@ func TestRenderRole_Deacon(t *testing.T) {
|
||||
}
|
||||
|
||||
data := RoleData{
|
||||
Role: "deacon",
|
||||
TownRoot: "/test/town",
|
||||
WorkDir: "/test/town",
|
||||
Role: "deacon",
|
||||
TownRoot: "/test/town",
|
||||
TownName: "town",
|
||||
WorkDir: "/test/town",
|
||||
MayorSession: "gt-town-mayor",
|
||||
DeaconSession: "gt-town-deacon",
|
||||
}
|
||||
|
||||
output, err := tmpl.RenderRole("deacon", data)
|
||||
|
||||
Reference in New Issue
Block a user