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 6m9s
CI / Lint (push) Failing after 2m12s
CI / Test Nix Flake (push) Failing after 56s
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (Windows - smoke) (push) Has been cancelled
Nightly Full Tests / Full Test Suite (push) Has started running

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 ed74560595
commit 259ddd9229

View File

@@ -81,8 +81,9 @@ func ensureStoreActive() error {
}
// Use factory to create the appropriate backend (SQLite, Dolt embedded, or Dolt server)
// based on metadata.json configuration
store, err := factory.NewFromConfig(getRootContext(), beadsDir)
// based on metadata.json configuration, with lock timeout support for multi-agent operations
opts := factory.Options{LockTimeout: lockTimeout}
store, err := factory.NewFromConfigWithOptions(getRootContext(), beadsDir, opts)
if err != nil {
// Check for fresh clone scenario (JSONL exists but no database)
if _, statErr := os.Stat(jsonlPath); statErr == nil {