fix(spawn): use rig-level beads instead of mayor/rig path

The spawn command and polecat manager were incorrectly looking for beads
in <rig>/mayor/rig/.beads instead of <rig>/.beads. This caused:
- `gt spawn --issue ga-xxp` to fail with "no issue found" even when
  `bd show ga-xxp` worked from the rig directory
- Polecats couldn't find rig-level issues (with ga- prefix) because
  mayor/rig has a different beads database (with gt- prefix)

This fix:
- spawn.go: Use r.Path instead of filepath.Join(r.Path, "mayor", "rig")
- polecat/manager.go: Use r.Path for beads.New() initialization
- session/manager.go: Use r.Path/.beads for BEADS_DIR environment

Closes beads-2nh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 23:28:06 -08:00
parent 71d313ed60
commit 43641e1dfb
4 changed files with 13 additions and 7 deletions

View File

@@ -197,8 +197,8 @@ func runSpawn(cmd *cobra.Command, args []string) error {
}
}
// Beads operations use mayor/rig directory (rig-level beads)
beadsPath := filepath.Join(r.Path, "mayor", "rig")
// Beads operations use rig-level beads (at rig root, not mayor/rig)
beadsPath := r.Path
// Sync beads to ensure fresh state before spawn operations
if err := syncBeads(beadsPath, true); err != nil {

View File

@@ -30,8 +30,8 @@ type Manager struct {
// NewManager creates a new polecat manager.
func NewManager(r *rig.Rig, g *git.Git) *Manager {
// Use the mayor's rig directory for beads operations (rig-level beads)
mayorRigPath := filepath.Join(r.Path, "mayor", "rig")
// Use the rig root for beads operations (rig-level beads at .beads/)
rigPath := r.Path
// Try to load rig config for namepool settings
rigConfigPath := filepath.Join(r.Path, ".gastown", "config.json")
@@ -56,7 +56,7 @@ func NewManager(r *rig.Rig, g *git.Git) *Manager {
return &Manager{
rig: r,
git: g,
beads: beads.New(mayorRigPath),
beads: beads.New(rigPath),
namePool: pool,
}
}

View File

@@ -125,9 +125,9 @@ func (m *Manager) Start(polecat string, opts StartOptions) error {
_ = m.tmux.SetEnvironment(sessionID, "GT_POLECAT", polecat)
// CRITICAL: Set beads environment for worktree polecats
// Polecats share the rig's beads directory (in mayor/rig/.beads)
// Polecats share the rig's beads directory (at rig root, not mayor/rig)
// BEADS_NO_DAEMON=1 prevents daemon from committing to wrong branch
beadsDir := filepath.Join(m.rig.Path, "mayor", "rig", ".beads")
beadsDir := filepath.Join(m.rig.Path, ".beads")
_ = m.tmux.SetEnvironment(sessionID, "BEADS_DIR", beadsDir)
_ = m.tmux.SetEnvironment(sessionID, "BEADS_NO_DAEMON", "1")
_ = m.tmux.SetEnvironment(sessionID, "BEADS_AGENT_NAME", fmt.Sprintf("%s/%s", m.rig.Name, polecat))