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)

View File

@@ -10,6 +10,7 @@ import (
"strings"
"time"
"github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/config"
"github.com/steveyegge/gastown/internal/constants"
"github.com/steveyegge/gastown/internal/rig"
@@ -194,8 +195,8 @@ func (m *SessionManager) Start(polecat string, opts SessionStartOptions) error {
}
// Set beads environment for worktree polecats (non-fatal)
townRoot := filepath.Dir(m.rig.Path)
beadsDir := filepath.Join(townRoot, ".beads")
// Use ResolveBeadsDir to follow redirects for repos with tracked beads
beadsDir := beads.ResolveBeadsDir(m.rig.Path)
debugSession("SetEnvironment BEADS_DIR", m.tmux.SetEnvironment(sessionID, "BEADS_DIR", beadsDir))
debugSession("SetEnvironment BEADS_NO_DAEMON", m.tmux.SetEnvironment(sessionID, "BEADS_NO_DAEMON", "1"))
debugSession("SetEnvironment BEADS_AGENT_NAME", m.tmux.SetEnvironment(sessionID, "BEADS_AGENT_NAME", fmt.Sprintf("%s/%s", m.rig.Name, polecat)))