fix(dolt): prevent daemon startup and fix routing same-dir check

- Daemon now refuses to start when dolt backend is configured
  (dolt uses sql-server mode, not the SQLite daemon)
- Add same-directory check in GetRoutedStorageWithOpener to avoid
  opening duplicate connections when routing resolves to current dir

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
emma
2026-01-24 17:39:44 -08:00
committed by gastown/crew/george
parent 4669de7625
commit bf0bf7b156
2 changed files with 24 additions and 0 deletions

View File

@@ -357,6 +357,25 @@ func runDaemonLoop(interval time.Duration, autoCommit, autoPush, autoPull, local
backend = configfile.BackendSQLite
}
// Daemon is not supported with dolt backend - refuse to start
if backend == configfile.BackendDolt {
errMsg := `DAEMON NOT SUPPORTED WITH DOLT BACKEND
The bd daemon is designed for SQLite backend only.
With dolt backend, connect directly to the dolt sql-server.
The daemon will now exit.`
log.Error(errMsg)
// Write error to file so user can see it without checking logs
errFile := filepath.Join(beadsDir, "daemon-error")
// nolint:gosec // G306: Error file needs to be readable for debugging
if err := os.WriteFile(errFile, []byte(errMsg), 0644); err != nil {
log.Warn("could not write daemon-error file", "error", err)
}
return
}
// Reset backoff on daemon start (fresh start, but preserve NeedsManualSync hint)
if !localMode {
ResetBackoffOnDaemonStart(beadsDir)

View File

@@ -455,6 +455,11 @@ func GetRoutedStorageWithOpener(ctx context.Context, id, currentBeadsDir string,
return nil, nil // No routing needed, caller should use existing storage
}
// Check if target is same as current - no need to open a new store
if beadsDir == currentBeadsDir {
return nil, nil // Same directory, caller should use existing storage
}
// Open storage for the routed directory
var store storage.Storage
if opener != nil {