refactor: update managers to use RoleEnvVars
Consolidates all role startup code to use the shared RoleEnvVars() function, ensuring consistent env vars across tmux SetEnvironment and Claude startup command exports. Updated: - Mayor manager - Deacon startup (daemon.go) - Witness manager - Refinery manager - Polecat startup (daemon.go) - BuildPolecatStartupCommand, BuildCrewStartupCommand helpers This ensures all agents receive the same identity env vars regardless of startup path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
2343e6b0ef
commit
7150ce2624
@@ -847,17 +847,19 @@ func (d *Daemon) restartPolecatSession(rigName, polecatName, sessionName string)
|
||||
}
|
||||
|
||||
// Set environment variables
|
||||
_ = d.tmux.SetEnvironment(sessionName, "GT_ROLE", "polecat")
|
||||
_ = d.tmux.SetEnvironment(sessionName, "GT_RIG", rigName)
|
||||
_ = d.tmux.SetEnvironment(sessionName, "GT_POLECAT", polecatName)
|
||||
|
||||
bdActor := fmt.Sprintf("%s/polecats/%s", rigName, polecatName)
|
||||
_ = d.tmux.SetEnvironment(sessionName, "BD_ACTOR", bdActor)
|
||||
// Use shared RoleEnvVars for consistency across all role startup paths
|
||||
envVars := config.RoleEnvVars("polecat", rigName, polecatName)
|
||||
|
||||
// Add polecat-specific beads configuration
|
||||
beadsDir := filepath.Join(d.config.TownRoot, rigName, ".beads")
|
||||
_ = d.tmux.SetEnvironment(sessionName, "BEADS_DIR", beadsDir)
|
||||
_ = d.tmux.SetEnvironment(sessionName, "BEADS_NO_DAEMON", "1")
|
||||
_ = d.tmux.SetEnvironment(sessionName, "BEADS_AGENT_NAME", fmt.Sprintf("%s/%s", rigName, polecatName))
|
||||
envVars["BEADS_DIR"] = beadsDir
|
||||
envVars["BEADS_NO_DAEMON"] = "1"
|
||||
envVars["BEADS_AGENT_NAME"] = fmt.Sprintf("%s/%s", rigName, polecatName)
|
||||
|
||||
// Set all env vars in tmux session (for debugging) and they'll also be exported to Claude
|
||||
for k, v := range envVars {
|
||||
_ = d.tmux.SetEnvironment(sessionName, k, v)
|
||||
}
|
||||
|
||||
// Apply theme
|
||||
theme := tmux.AssignTheme(rigName)
|
||||
@@ -870,7 +872,7 @@ func (d *Daemon) restartPolecatSession(rigName, polecatName, sessionName string)
|
||||
// Launch Claude with environment exported inline
|
||||
// Pass rigPath so rig agent settings are honored (not town-level defaults)
|
||||
rigPath := filepath.Join(d.config.TownRoot, rigName)
|
||||
startCmd := config.BuildPolecatStartupCommand(rigName, polecatName, rigPath, "")
|
||||
startCmd := config.BuildStartupCommand(envVars, rigPath, "")
|
||||
if err := d.tmux.SendKeys(sessionName, startCmd); err != nil {
|
||||
return fmt.Errorf("sending startup command: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user