fix(sling): use --no-daemon consistently in bd calls (h-3f96b)
Some checks failed
CI / Check for .beads changes (push) Has been skipped
CI / Check embedded formulas (push) Failing after 24s
CI / Test (push) Failing after 1m33s
CI / Lint (push) Failing after 22s
CI / Coverage Report (push) Has been cancelled
Windows CI / Windows Build and Unit Tests (push) Has been cancelled
CI / Integration Tests (push) Has been cancelled

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 <noreply@anthropic.com>
This commit is contained in:
furiosa
2026-01-25 09:50:27 -08:00
committed by John Ogle
parent b9654f1090
commit f229a966f1

View File

@@ -137,12 +137,18 @@ func storeDispatcherInBead(beadID, dispatcher string) error {
} }
// Get the bead to preserve existing description content // 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() out, err := showCmd.Output()
if err != nil { if err != nil {
return fmt.Errorf("fetching bead: %w", err) 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 // Parse the bead
var issues []beads.Issue var issues []beads.Issue
if err := json.Unmarshal(out, &issues); err != nil { if err := json.Unmarshal(out, &issues); err != nil {
@@ -165,8 +171,8 @@ func storeDispatcherInBead(beadID, dispatcher string) error {
// Update the description // Update the description
newDesc := beads.SetAttachmentFields(issue, fields) newDesc := beads.SetAttachmentFields(issue, fields)
// Update the bead // Update the bead (use --no-daemon for consistency)
updateCmd := exec.Command("bd", "update", beadID, "--description="+newDesc) updateCmd := exec.Command("bd", "--no-daemon", "update", beadID, "--description="+newDesc)
updateCmd.Stderr = os.Stderr updateCmd.Stderr = os.Stderr
if err := updateCmd.Run(); err != nil { if err := updateCmd.Run(); err != nil {
return fmt.Errorf("updating bead description: %w", err) return fmt.Errorf("updating bead description: %w", err)
@@ -190,12 +196,18 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error {
issue := &beads.Issue{} issue := &beads.Issue{}
if logPath == "" { if logPath == "" {
// Get the bead to preserve existing description content // 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() out, err := showCmd.Output()
if err != nil { if err != nil {
return fmt.Errorf("fetching bead: %w", err) 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 // Parse the bead
var issues []beads.Issue var issues []beads.Issue
if err := json.Unmarshal(out, &issues); err != nil { if err := json.Unmarshal(out, &issues); err != nil {
@@ -225,8 +237,8 @@ func storeAttachedMoleculeInBead(beadID, moleculeID string) error {
_ = os.WriteFile(logPath, []byte(newDesc), 0644) _ = os.WriteFile(logPath, []byte(newDesc), 0644)
} }
// Update the bead // Update the bead (use --no-daemon for consistency)
updateCmd := exec.Command("bd", "update", beadID, "--description="+newDesc) updateCmd := exec.Command("bd", "--no-daemon", "update", beadID, "--description="+newDesc)
updateCmd.Stderr = os.Stderr updateCmd.Stderr = os.Stderr
if err := updateCmd.Run(); err != nil { if err := updateCmd.Run(); err != nil {
return fmt.Errorf("updating bead description: %w", err) return fmt.Errorf("updating bead description: %w", err)