fix: use ResolveBeadsDir for polecat BEADS_DIR

Previously, polecat startup used hardcoded paths for BEADS_DIR that
didn't follow redirects for repos with tracked beads. This meant
polecats working in worktrees (where .beads/redirect points to the
actual beads location) would use the wrong beads directory.

Fixed locations:
- daemon.go: polecat startup now uses ResolveBeadsDir
- polecat/session_manager.go: session startup now uses ResolveBeadsDir

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
julianknutsen
2026-01-09 03:28:46 -08:00
committed by Steve Yegge
parent 7150ce2624
commit 1d88a73eaa
2 changed files with 6 additions and 4 deletions

View File

@@ -851,7 +851,9 @@ func (d *Daemon) restartPolecatSession(rigName, polecatName, sessionName string)
envVars := config.RoleEnvVars("polecat", rigName, polecatName)
// Add polecat-specific beads configuration
beadsDir := filepath.Join(d.config.TownRoot, rigName, ".beads")
// Use ResolveBeadsDir to follow redirects for repos with tracked beads
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)
@@ -871,7 +873,6 @@ 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.BuildStartupCommand(envVars, rigPath, "")
if err := d.tmux.SendKeys(sessionName, startCmd); err != nil {
return fmt.Errorf("sending startup command: %w", err)