From 3962597950421e422b6e1ce57764550f5600ded6 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Tue, 3 Mar 2026 21:22:30 +0000 Subject: Fix working_dir failures: validate path early, remove hardcoded /root executor/claude.go: stat working_dir before cmd.Start() so a missing or inaccessible directory surfaces as a clear error ("working_dir \"/bad/path\": no such file or directory") rather than an opaque chdir failure wrapped in "starting claude". api/elaborate.go: replace the hardcoded /root/workspace/claudomator path with buildElaboratePrompt(workDir) which injects the server's actual working directory (from os.Getwd() at startup). Empty workDir tells the model to leave working_dir blank. Co-Authored-By: Claude Sonnet 4.6 --- internal/api/server.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/api/server.go') diff --git a/internal/api/server.go b/internal/api/server.go index 315b64b..8415b28 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -6,6 +6,7 @@ import ( "fmt" "log/slog" "net/http" + "os" "time" "github.com/thepeterstone/claudomator/internal/executor" @@ -25,9 +26,11 @@ type Server struct { mux *http.ServeMux claudeBinPath string // path to claude binary; defaults to "claude" elaborateCmdPath string // overrides claudeBinPath; used in tests + workDir string // working directory injected into elaborate system prompt } func NewServer(store *storage.DB, pool *executor.Pool, logger *slog.Logger, claudeBinPath string) *Server { + wd, _ := os.Getwd() s := &Server{ store: store, logStore: store, @@ -36,6 +39,7 @@ func NewServer(store *storage.DB, pool *executor.Pool, logger *slog.Logger, clau logger: logger, mux: http.NewServeMux(), claudeBinPath: claudeBinPath, + workDir: wd, } s.routes() return s -- cgit v1.2.3