fix: skip daemon auto-start for all Dolt backends

The daemon is SQLite-specific (handles JSONL sync to git). Dolt has its
own sync mechanism via sql-server and doesn't need the daemon.

Previously, Dolt server mode returned SingleProcessOnly=false (because
multiple bd processes CAN connect to the same SQL server), which
incorrectly triggered daemon auto-start. The daemon would then fail
with 'DAEMON NOT SUPPORTED WITH DOLT BACKEND' warning on every command.

Now we check isDoltBackend() directly instead of relying on the
SingleProcessOnly capability, which has different semantics.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: mayor
Role: mayor
This commit is contained in:
mayor
2026-01-25 17:34:10 -08:00
committed by gastown/crew/joe
parent 132f9d2f6f
commit 5ed65ed6a8

View File

@@ -47,6 +47,28 @@ var (
sendStopSignalFn = sendStopSignal sendStopSignalFn = sendStopSignal
) )
// isDoltBackend returns true if the current workspace uses any Dolt backend mode.
// The daemon is only needed for SQLite - Dolt has its own sync mechanism.
func isDoltBackend() bool {
beadsDir := ""
if dbPath != "" {
beadsDir = filepath.Dir(dbPath)
} else if found := beads.FindDatabasePath(); found != "" {
beadsDir = filepath.Dir(found)
} else {
beadsDir = beads.FindBeadsDir()
}
if beadsDir == "" {
return false
}
cfg, err := configfile.Load(beadsDir)
if err != nil || cfg == nil {
return false
}
return cfg.GetBackend() == configfile.BackendDolt
}
// singleProcessOnlyBackend returns true if the current workspace backend is configured // singleProcessOnlyBackend returns true if the current workspace backend is configured
// as single-process-only (currently Dolt embedded). // as single-process-only (currently Dolt embedded).
// //
@@ -75,7 +97,13 @@ func singleProcessOnlyBackend() bool {
// shouldAutoStartDaemon checks if daemon auto-start is enabled // shouldAutoStartDaemon checks if daemon auto-start is enabled
func shouldAutoStartDaemon() bool { func shouldAutoStartDaemon() bool {
// Dolt backend is single-process-only; do not auto-start daemon. // Dolt backend doesn't need daemon - it has its own sync via dolt sql-server.
// This applies to both embedded and server modes.
if isDoltBackend() {
return false
}
// For other backends, check SingleProcessOnly capability
if singleProcessOnlyBackend() { if singleProcessOnlyBackend() {
return false return false
} }
@@ -103,7 +131,13 @@ func shouldAutoStartDaemon() bool {
// restartDaemonForVersionMismatch stops the old daemon and starts a new one // restartDaemonForVersionMismatch stops the old daemon and starts a new one
// Returns true if restart was successful // Returns true if restart was successful
func restartDaemonForVersionMismatch() bool { func restartDaemonForVersionMismatch() bool {
// Dolt backend is single-process-only; do not restart/spawn daemon. // Dolt backend doesn't need daemon - it has its own sync mechanism.
if isDoltBackend() {
debugLog("dolt backend: skipping daemon restart for version mismatch")
return false
}
// For other backends, check SingleProcessOnly capability
if singleProcessOnlyBackend() { if singleProcessOnlyBackend() {
debugLog("single-process backend: skipping daemon restart for version mismatch") debugLog("single-process backend: skipping daemon restart for version mismatch")
return false return false
@@ -212,7 +246,12 @@ func isDaemonRunningQuiet(pidFile string) bool {
// tryAutoStartDaemon attempts to start the daemon in the background // tryAutoStartDaemon attempts to start the daemon in the background
// Returns true if daemon was started successfully and socket is ready // Returns true if daemon was started successfully and socket is ready
func tryAutoStartDaemon(socketPath string) bool { func tryAutoStartDaemon(socketPath string) bool {
// Dolt backend is single-process-only; do not auto-start daemon. // Dolt backend doesn't need daemon - it has its own sync mechanism.
if isDoltBackend() {
return false
}
// For other backends, check SingleProcessOnly capability
if singleProcessOnlyBackend() { if singleProcessOnlyBackend() {
return false return false
} }
@@ -398,7 +437,13 @@ func ensureLockDirectory(lockPath string) error {
} }
func startDaemonProcess(socketPath string) bool { func startDaemonProcess(socketPath string) bool {
// Dolt backend is single-process-only; do not spawn a daemon. // Dolt backend doesn't need daemon - it has its own sync mechanism.
if isDoltBackend() {
debugLog("dolt backend: skipping daemon start")
return false
}
// For other backends, check SingleProcessOnly capability
if singleProcessOnlyBackend() { if singleProcessOnlyBackend() {
debugLog("single-process backend: skipping daemon start") debugLog("single-process backend: skipping daemon start")
return false return false