Skip to content

Commit 52ef89c

Browse files
steveyeggeclaude
andcommitted
fix(sling): use bd native prefix routing instead of BEADS_DIR override
verifyBeadExists was setting BEADS_DIR to town root, which overrides bd's native prefix-based routing via routes.jsonl. This broke resolution of rig-level beads (e.g., gt-* beads routed via gt- -> gastown/mayor/rig). Fix: - Remove BEADS_DIR override in verifyBeadExists - Set cmd.Dir to town root so bd can find routes.jsonl - Apply same fix to getBeadInfo for consistency Now gt sling gt-xxx correctly finds beads using the same routing as bd show gt-xxx. (gt-l5qwb) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2922aff commit 52ef89c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

internal/cmd/sling.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,13 @@ func sessionToAgentID(sessionName string) string {
680680
}
681681

682682
// verifyBeadExists checks that the bead exists using bd show.
683+
// Uses bd's native prefix-based routing via routes.jsonl - do NOT set BEADS_DIR
684+
// as that overrides routing and breaks resolution of rig-level beads.
683685
func verifyBeadExists(beadID string) error {
684686
cmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json")
685-
// Set BEADS_DIR to town root so hq-* beads are accessible
687+
// Run from town root so bd can find routes.jsonl for prefix-based routing.
688+
// Do NOT set BEADS_DIR - that overrides routing and breaks rig bead resolution.
686689
if townRoot, err := workspace.FindFromCwd(); err == nil {
687-
cmd.Env = append(os.Environ(), "BEADS_DIR="+filepath.Join(townRoot, ".beads"))
688690
cmd.Dir = townRoot
689691
}
690692
if err := cmd.Run(); err != nil {
@@ -701,8 +703,13 @@ type beadInfo struct {
701703
}
702704

703705
// getBeadInfo returns status and assignee for a bead.
706+
// Uses bd's native prefix-based routing via routes.jsonl.
704707
func getBeadInfo(beadID string) (*beadInfo, error) {
705708
cmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json")
709+
// Run from town root so bd can find routes.jsonl for prefix-based routing.
710+
if townRoot, err := workspace.FindFromCwd(); err == nil {
711+
cmd.Dir = townRoot
712+
}
706713
out, err := cmd.Output()
707714
if err != nil {
708715
return nil, fmt.Errorf("bead '%s' not found", beadID)

0 commit comments

Comments
 (0)