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)