From 52ef89c55900e64effc91eddc9b194720fc1a488 Mon Sep 17 00:00:00 2001 From: jack Date: Tue, 6 Jan 2026 22:56:48 -0800 Subject: [PATCH] fix(sling): use bd native prefix routing instead of BEADS_DIR override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- internal/cmd/sling.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/cmd/sling.go b/internal/cmd/sling.go index 2e5c2a61..444e1d82 100644 --- a/internal/cmd/sling.go +++ b/internal/cmd/sling.go @@ -680,11 +680,13 @@ func sessionToAgentID(sessionName string) string { } // verifyBeadExists checks that the bead exists using bd show. +// Uses bd's native prefix-based routing via routes.jsonl - do NOT set BEADS_DIR +// as that overrides routing and breaks resolution of rig-level beads. func verifyBeadExists(beadID string) error { cmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json") - // Set BEADS_DIR to town root so hq-* beads are accessible + // Run from town root so bd can find routes.jsonl for prefix-based routing. + // Do NOT set BEADS_DIR - that overrides routing and breaks rig bead resolution. if townRoot, err := workspace.FindFromCwd(); err == nil { - cmd.Env = append(os.Environ(), "BEADS_DIR="+filepath.Join(townRoot, ".beads")) cmd.Dir = townRoot } if err := cmd.Run(); err != nil { @@ -701,8 +703,13 @@ type beadInfo struct { } // getBeadInfo returns status and assignee for a bead. +// Uses bd's native prefix-based routing via routes.jsonl. func getBeadInfo(beadID string) (*beadInfo, error) { cmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json") + // Run from town root so bd can find routes.jsonl for prefix-based routing. + if townRoot, err := workspace.FindFromCwd(); err == nil { + cmd.Dir = townRoot + } out, err := cmd.Output() if err != nil { return nil, fmt.Errorf("bead '%s' not found", beadID)