fix(sqlite): respect --lock-timeout flag in direct mode (bd-2zd.4)
Some checks failed
CI / Check version consistency (push) Successful in 4s
CI / Check for .beads changes (push) Has been skipped
CI / Test (ubuntu-latest) (push) Failing after 6m57s
CI / Lint (push) Failing after 2m33s
CI / Test Nix Flake (push) Failing after 51s
Nightly Full Tests / Full Test Suite (push) Failing after 35m46s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled

The ensureStoreActive() function was ignoring the user-configured
--lock-timeout flag and always using the 30s default via sqlite.New().

This fix changes ensureStoreActive() to use sqlite.NewWithTimeout()
with the configured lockTimeout, allowing users to specify shorter
timeouts for multi-agent scenarios.

With this change, users can now run:
  bd --lock-timeout=500ms sync

to fail fast if the database is locked, rather than waiting 30s.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jasper
2026-01-24 17:25:11 -08:00
committed by John Ogle
parent 28949eaf26
commit bfffc47715

View File

@@ -89,7 +89,9 @@ func ensureStoreActive() error {
}
}
sqlStore, err := sqlite.New(getRootContext(), path)
// Use configured lock timeout (default 30s, can be overridden via --lock-timeout)
// This fixes bd-2zd.4: SQLite lock contention during multi-agent operations
sqlStore, err := sqlite.NewWithTimeout(getRootContext(), path, lockTimeout)
if err != nil {
// Check for fresh clone scenario
if isFreshCloneError(err) {