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:
@@ -11,7 +11,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/steveyegge/gastown/internal/config"
|
||||
"github.com/steveyegge/gastown/internal/session"
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
"github.com/steveyegge/gastown/internal/workspace"
|
||||
)
|
||||
|
||||
// ErrUnknownList indicates a mailing list name was not found in configuration.
|
||||
@@ -934,7 +936,13 @@ func (r *Router) GetMailbox(address string) (*Mailbox, error) {
|
||||
// Uses send-keys to echo a visible banner to ensure notification is seen.
|
||||
// Supports mayor/, rig/polecat, and rig/refinery addresses.
|
||||
func (r *Router) notifyRecipient(msg *Message) error {
|
||||
sessionID := addressToSessionID(msg.To)
|
||||
// Get town name for session name generation
|
||||
var townName string
|
||||
if r.townRoot != "" {
|
||||
townName, _ = workspace.GetTownName(r.townRoot)
|
||||
}
|
||||
|
||||
sessionID := addressToSessionID(msg.To, townName)
|
||||
if sessionID == "" {
|
||||
return nil // Unable to determine session ID
|
||||
}
|
||||
@@ -951,10 +959,21 @@ func (r *Router) notifyRecipient(msg *Message) error {
|
||||
|
||||
// addressToSessionID converts a mail address to a tmux session ID.
|
||||
// Returns empty string if address format is not recognized.
|
||||
func addressToSessionID(address string) string {
|
||||
func addressToSessionID(address, townName string) string {
|
||||
// Mayor address: "mayor/" or "mayor"
|
||||
if strings.HasPrefix(address, "mayor") {
|
||||
return "gt-mayor"
|
||||
if townName != "" {
|
||||
return session.MayorSessionName(townName)
|
||||
}
|
||||
return "" // Cannot generate session name without town name
|
||||
}
|
||||
|
||||
// Deacon address: "deacon/" or "deacon"
|
||||
if strings.HasPrefix(address, "deacon") {
|
||||
if townName != "" {
|
||||
return session.DeaconSessionName(townName)
|
||||
}
|
||||
return "" // Cannot generate session name without town name
|
||||
}
|
||||
|
||||
// Rig-based address: "rig/target"
|
||||
|
||||
Reference in New Issue
Block a user