fix(config): don't export empty GT_ROOT/BEADS_DIR in AgentEnv (#385)
* fix(config): don't export empty GT_ROOT/BEADS_DIR in AgentEnv Fix polecats not having GT_ROOT environment variable set. The symptom was polecat sessions showing GT_ROOT="" instead of the expected town root. Root cause: AgentEnvSimple doesn't set TownRoot, but AgentEnv was always setting env["GT_ROOT"] = cfg.TownRoot even when empty. This empty value in export commands would override the tmux session environment. Changes: - Only set GT_ROOT and BEADS_DIR in env map if non-empty - Refactor daemon.go to use AgentEnv with full AgentEnvConfig instead of AgentEnvSimple + manual additions - Update test to verify keys are absent rather than empty Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(lint): silence unparam for unused executeExternalActions args The external action params (beadID, severity, description) are reserved for future email/SMS/slack implementations but currently unused. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: julianknutsen <julianknutsen@users.noreply.github> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: max <steve.yegge@gmail.com>
This commit is contained in:
@@ -849,17 +849,16 @@ func (d *Daemon) restartPolecatSession(rigName, polecatName, sessionName string)
|
||||
return fmt.Errorf("creating session: %w", err)
|
||||
}
|
||||
|
||||
// Set environment variables
|
||||
// Use centralized AgentEnvSimple for consistency across all role startup paths
|
||||
envVars := config.AgentEnvSimple("polecat", rigName, polecatName)
|
||||
|
||||
// Add polecat-specific beads configuration
|
||||
// Use ResolveBeadsDir to follow redirects for repos with tracked beads
|
||||
// Set environment variables using centralized AgentEnv
|
||||
rigPath := filepath.Join(d.config.TownRoot, rigName)
|
||||
beadsDir := beads.ResolveBeadsDir(rigPath)
|
||||
envVars["BEADS_DIR"] = beadsDir
|
||||
envVars["BEADS_NO_DAEMON"] = "1"
|
||||
envVars["BEADS_AGENT_NAME"] = fmt.Sprintf("%s/%s", rigName, polecatName)
|
||||
envVars := config.AgentEnv(config.AgentEnvConfig{
|
||||
Role: "polecat",
|
||||
Rig: rigName,
|
||||
AgentName: polecatName,
|
||||
TownRoot: d.config.TownRoot,
|
||||
BeadsDir: beads.ResolveBeadsDir(rigPath),
|
||||
BeadsNoDaemon: true,
|
||||
})
|
||||
|
||||
// Set all env vars in tmux session (for debugging) and they'll also be exported to Claude
|
||||
for k, v := range envVars {
|
||||
|
||||
Reference in New Issue
Block a user