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:
committed by
GitHub
parent
89b5f8e203
commit
a731f5a48f
@@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/steveyegge/beads/internal/beads"
|
||||
"github.com/steveyegge/beads/internal/rpc"
|
||||
)
|
||||
|
||||
// ensureBeadsDir ensures the local beads directory exists (.beads in the current workspace)
|
||||
@@ -60,13 +61,16 @@ func getEnvBool(key string, defaultValue bool) bool {
|
||||
|
||||
// getSocketPathForPID determines the socket path for a given PID file.
|
||||
// If BD_SOCKET env var is set, uses that value instead.
|
||||
// Uses rpc.ShortSocketPath to avoid Unix socket path length limits (macOS: 104 chars).
|
||||
func getSocketPathForPID(pidFile string) string {
|
||||
// Check environment variable first (enables test isolation)
|
||||
if socketPath := os.Getenv("BD_SOCKET"); socketPath != "" {
|
||||
return socketPath
|
||||
}
|
||||
// Socket is in same directory as PID file
|
||||
return filepath.Join(filepath.Dir(pidFile), "bd.sock")
|
||||
// PID file is in .beads/, so workspace is parent of that
|
||||
beadsDir := filepath.Dir(pidFile)
|
||||
workspacePath := filepath.Dir(beadsDir)
|
||||
return rpc.ShortSocketPath(workspacePath)
|
||||
}
|
||||
|
||||
// getPIDFilePath returns the path to the daemon PID file
|
||||
|
||||
Reference in New Issue
Block a user