fix(daemon): complete socket path shortening for long workspace paths (GH#1001) (#1008)

fix(daemon): socket path shortening for long workspace paths

Fixes GH#1001 where long workspace paths (e.g., pytest temp directories) caused
socket path mismatches. The daemon now uses rpc.ShortSocketPath() consistently
with the client.

Changes:
- daemon.go: Use rpc.ShortSocketPath() + EnsureSocketDir() for daemon socket
- daemon_config.go: Update getSocketPathForPID() to use rpc.ShortSocketPath()
- Added tests for long path handling and client-daemon socket path agreement

Co-Authored-By: Eugene Sukhodolin <sukhodolin@users.noreply.github.com>
This commit is contained in:
Eugene Sukhodolin
2026-01-10 22:50:16 -08:00
committed by GitHub
parent 89b5f8e203
commit a731f5a48f
3 changed files with 85 additions and 3 deletions

View File

@@ -478,7 +478,12 @@ func runDaemonLoop(interval time.Duration, autoCommit, autoPush, autoPull, local
// Get workspace path (.beads directory) - beadsDir already defined above
// Get actual workspace root (parent of .beads)
workspacePath := filepath.Dir(beadsDir)
socketPath := filepath.Join(beadsDir, "bd.sock")
// Use short socket path to avoid Unix socket path length limits (macOS: 104 chars)
socketPath, err := rpc.EnsureSocketDir(rpc.ShortSocketPath(workspacePath))
if err != nil {
log.Error("failed to create socket directory", "error", err)
return
}
serverCtx, serverCancel := context.WithCancel(ctx)
defer serverCancel()