fix: relocate daemon socket for deep paths (GH#1001)
On Unix systems, socket paths are limited to 104 chars (macOS) or 108 chars
(Linux). Deep workspace paths like /Volumes/External Drive/Dropbox/...
would exceed this limit and cause daemon startup failures.
This fix:
- Adds ShortSocketPath() which computes /tmp/beads-{hash}/bd.sock for
paths that would exceed the limit
- Keeps backward compatibility: short paths still use .beads/bd.sock
- Updates daemon discovery to check both locations
- Uses SHA256 hash of canonical workspace path for unique directories
Closes GH#1001
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
35
internal/rpc/socket_path_windows.go
Normal file
35
internal/rpc/socket_path_windows.go
Normal file
@@ -0,0 +1,35 @@
|
||||
//go:build windows
|
||||
|
||||
package rpc
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// MaxUnixSocketPath is not applicable on Windows (uses TCP).
|
||||
// Kept for API compatibility.
|
||||
const MaxUnixSocketPath = 103
|
||||
|
||||
// ShortSocketPath returns the socket path for Windows.
|
||||
// Windows uses TCP instead of Unix sockets, so path length is not a concern.
|
||||
// The "socket path" is actually a file containing the TCP endpoint info.
|
||||
func ShortSocketPath(workspacePath string) string {
|
||||
return filepath.Join(workspacePath, ".beads", "bd.sock")
|
||||
}
|
||||
|
||||
// EnsureSocketDir is a no-op on Windows since the .beads directory
|
||||
// should already exist.
|
||||
func EnsureSocketDir(socketPath string) (string, error) {
|
||||
return socketPath, nil
|
||||
}
|
||||
|
||||
// CleanupSocketDir removes the socket file on Windows.
|
||||
func CleanupSocketDir(socketPath string) error {
|
||||
return os.Remove(socketPath)
|
||||
}
|
||||
|
||||
// NeedsShortPath always returns false on Windows since TCP is used.
|
||||
func NeedsShortPath(workspacePath string) bool {
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user