From f229a966f1c21909f904681a4ed86f21f24abe05 Mon Sep 17 00:00:00 2001 From: furiosa Date: Sun, 25 Jan 2026 09:50:27 -0800 Subject: [PATCH] fix(sling): use --no-daemon consistently in bd calls (h-3f96b) storeDispatcherInBead and storeAttachedMoleculeInBead were calling bd show/update without --no-daemon, while all other sling operations used --no-daemon. This inconsistency could cause daemon socket hangs if the daemon was in a bad state during sling operations. Changes: - Add --no-daemon --allow-stale to bd show calls in both functions - Add --no-daemon to bd update calls in both functions - Add empty stdout check for bd --no-daemon exit 0 bug Co-Authored-By: Claude Opus 4.5 --- internal/cmd/sling_helpers.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/internal/cmd/sling_helpers.go b/internal/cmd/sling_helpers.go index 469a85b2..b2b7837d 100644 --- a/internal/cmd/sling_helpers.go +++ b/internal/cmd/sling_helpers.go @@ -137,12 +137,18 @@ func storeDispatcherInBead(beadID, dispatcher string) error { } // Get the bead to preserve existing description content - showCmd := exec.Command("bd", "show", beadID, "--json") + // Use --no-daemon for consistency with other sling operations (see h-3f96b) + showCmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json", "--allow-stale") out, err := showCmd.Output() if err != nil { return fmt.Errorf("fetching bead: %w", err) } + // Handle bd --no-daemon exit 0 bug: empty stdout means not found + if len(out) == 0 { + return fmt.Errorf("bead not found") + } + // Parse the bead var issues []beads.Issue if err := json.Unmarshal(out, &issues); err != nil { @@ -165,8 +171,8 @@ func storeDispatcherInBead(beadID, dispatcher string) error { // Update the description newDesc := beads.SetAttachmentFields(issue, fields) - // Update the bead - updateCmd := exec.Command("bd", "update", beadID, "--description="+newDesc) + // Update the bead (use --no-daemon for consistency) + updateCmd := exec.Command("bd", "--no-daemon", "update", beadID, "--description="+newDesc) updateCmd.Stderr = os.Stderr if err := updateCmd.Run(); err != nil { return fmt.Errorf("updating bead description: %w", err) @@ -190,12 +196,18 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error { issue := &beads.Issue{} if logPath == "" { // Get the bead to preserve existing description content - showCmd := exec.Command("bd", "show", beadID, "--json") + // Use --no-daemon for consistency with other sling operations (see h-3f96b) + showCmd := exec.Command("bd", "--no-daemon", "show", beadID, "--json", "--allow-stale") out, err := showCmd.Output() if err != nil { return fmt.Errorf("fetching bead: %w", err) } + // Handle bd --no-daemon exit 0 bug: empty stdout means not found + if len(out) == 0 { + return fmt.Errorf("bead not found") + } + // Parse the bead var issues []beads.Issue if err := json.Unmarshal(out, &issues); err != nil { @@ -225,8 +237,8 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error { _ = os.WriteFile(logPath, []byte(newDesc), 0644) } - // Update the bead - updateCmd := exec.Command("bd", "update", beadID, "--description="+newDesc) + // Update the bead (use --no-daemon for consistency) + updateCmd := exec.Command("bd", "--no-daemon", "update", beadID, "--description="+newDesc) updateCmd.Stderr = os.Stderr if err := updateCmd.Run(); err != nil { return fmt.Errorf("updating bead description: %w", err)