Repository navigation
Description
Symptom
Every agent attach to a durable environment dies immediately:
executor: acp session attach (environment <id>): acp: session/new: Invalid params: invalid directory path
The conversation is recorded failed in milliseconds, the agent never runs, and nothing in the UI says which folder is wrong.
Cause
EnvironmentFolder.Path is what the api hands to the runner as the conversation's workdir, and the runner passes it as session/new's cwd. AddFolder only required a leading /, so any absolute path was accepted and handed to agent-runner's mkdir -p:
path := strings.TrimSpace(in.Path)
if !strings.HasPrefix(path, "/") {
return nil, environmentdom.ErrFolderPathInvalid
}A path outside the mounted workspace volume is created in the container's writable layer, not on the PVC. It works until the Pod is recreated and is then gone — so the folder row keeps pointing at a directory that no longer exists, and session/new rejects the cwd from then on. Observed live: a folder row at /home/paca-dev/workspaces (the environment mounts its PVC at /home/paca/workspaces), created while the environment was running. Reproduced against the environment's own agent-server with the same image:
session/newcwd=/home/paca-dev/workspaces→{"code":-32602,"message":"Invalid params","data":"invalid directory path"}session/newcwd=/home/paca/workspaces/<sub>→sessionIdreturned
Browse and agent-runner's own mkdir/delete guards are already scoped to environmentHomeRoot (services/agent-runner/internal/acpbridge/environment_handlers.go) — the create path is the one place that was not.
Fix
AddFoldercleans the path and requires it to beenvironmentHomeRootor under it, rejecting anything else with the existingErrFolderPathInvalid(already mapped to400 ENVIRONMENT_FOLDER_PATH_INVALID), and stores the cleaned path.- The folder-creation dialog's client-side pre-check uses the same root instead of "any absolute path", so the mistake is caught before submit.
A table test covers: root, subfolder, trailing slash, outside the volume, a sibling that only shares the prefix (/home/paca/workspaces-other), .. traversal out of the root, relative and empty paths.
Acceptance
- A folder path outside
/home/paca/workspacesreturns400 ENVIRONMENT_FOLDER_PATH_INVALIDand creates no row. - Existing valid paths, including the workspace root itself, still create.
mkdiris never asked for a path that cannot survive a Pod recreation.
Rows already stored outside the root are not migrated by this change; they have to be corrected (or deleted) by hand, since the directory they name is gone too.
Activity
pullfrog commentedon Oct 28, 2026