From a73899bc2f7a3a0604bdf744bdf7d30af92872aa Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 31 Jul 2026 09:28:44 +0200 Subject: [PATCH] session: reject creation with non-existent cwd When a session is created with a cwd that doesn't exist, all tool execution fails with a confusing 'fork/exec landrun: no such file or directory' because exec.Command sets cmd.Dir to the non-existent path. Validate that cwd exists and is a directory at session creation time, returning a clear error instead of allowing a broken session. Also includes the earlier USER/NAMESPACE env export fix (agent.go, shell.go) for the ollie-9p namespace path issue. --- fs/session/create.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/session/create.go b/fs/session/create.go index f696c94..6186a75 100644 --- a/fs/session/create.go +++ b/fs/session/create.go @@ -63,6 +63,11 @@ func Create(rs *rootState, args []string) (string, error) { if cwd == "" { return "", fmt.Errorf("cwd is required (e.g. new cwd=/path/to/project)") } + if info, err := os.Stat(cwd); err != nil { + return "", fmt.Errorf("cwd %q does not exist", cwd) + } else if !info.IsDir() { + return "", fmt.Errorf("cwd %q is not a directory", cwd) + } sessID := name if sessID == "" {