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:
markov-kernel
2026-01-03 21:21:00 +01:00
parent 7f9795f630
commit e7145cfd77
46 changed files with 4772 additions and 1615 deletions

View File

@@ -7,8 +7,8 @@ import (
func TestResolveNudgePattern(t *testing.T) {
// Create test agent sessions
agents := []*AgentSession{
{Name: "gt-mayor", Type: AgentMayor},
{Name: "gt-deacon", Type: AgentDeacon},
{Name: "gt-ai-mayor", Type: AgentMayor, Town: "ai"},
{Name: "gt-ai-deacon", Type: AgentDeacon, Town: "ai"},
{Name: "gt-gastown-witness", Type: AgentWitness, Rig: "gastown"},
{Name: "gt-gastown-refinery", Type: AgentRefinery, Rig: "gastown"},
{Name: "gt-gastown-crew-max", Type: AgentCrew, Rig: "gastown", AgentName: "max"},
@@ -27,12 +27,12 @@ func TestResolveNudgePattern(t *testing.T) {
{
name: "mayor special case",
pattern: "mayor",
expected: []string{"gt-mayor"},
expected: []string{"gt-ai-mayor"},
},
{
name: "deacon special case",
pattern: "deacon",
expected: []string{"gt-deacon"},
expected: []string{"gt-ai-deacon"},
},
{
name: "specific witness",
@@ -86,9 +86,10 @@ func TestResolveNudgePattern(t *testing.T) {
},
}
townName := "ai"
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := resolveNudgePattern(tt.pattern, agents)
got := resolveNudgePattern(tt.pattern, agents, townName)
if len(got) != len(tt.expected) {
t.Errorf("resolveNudgePattern(%q) returned %d results, want %d: got %v, want %v",