fix: add --allow-stale to --no-daemon reads for resilience (#465)
The beads.go run() function uses --no-daemon for faster read operations, but this fails when the database is out of sync with JSONL (e.g., after the daemon is killed during shutdown before it can sync). Adding --allow-stale prevents these failures and makes witness/refinery startup more reliable after gt down --all.
This commit is contained in:
@@ -129,8 +129,10 @@ func NewWithBeadsDir(workDir, beadsDir string) *Beads {
|
||||
// run executes a bd command and returns stdout.
|
||||
func (b *Beads) run(args ...string) ([]byte, error) {
|
||||
// Use --no-daemon for faster read operations (avoids daemon IPC overhead)
|
||||
// The daemon is primarily useful for write coalescing, not reads
|
||||
fullArgs := append([]string{"--no-daemon"}, args...)
|
||||
// The daemon is primarily useful for write coalescing, not reads.
|
||||
// Use --allow-stale to prevent failures when db is out of sync with JSONL
|
||||
// (e.g., after daemon is killed during shutdown before syncing).
|
||||
fullArgs := append([]string{"--no-daemon", "--allow-stale"}, args...)
|
||||
cmd := exec.Command("bd", fullArgs...) //nolint:gosec // G204: bd is a trusted internal tool
|
||||
cmd.Dir = b.workDir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user