Skip to main content

effective_cwd

Function effective_cwd 

Source
fn effective_cwd(
    req: &ShellCreateRequest,
    agent_block: Option<&Block>,
    remote: bool,
) -> Option<String>
Expand description

Where the command starts. If cwd wasn’t supplied by the caller, fall back to the agent block’s cmd:cwd — the working directory the agent pane was launched with. Without this, ShellNodeRunner would inherit agentmux-srv’s cwd (typically the portable runtime/ dir) instead of the project dir.

In WSL or over SSH the cwd is a path on the other side, given as is, and the agent’s own directory is no fallback for it: the remote home is. A local one is normalized before it reaches the spawner: agents on Windows run inside a bash shell and emit MSYS paths like /c/Users/user/project, which Command::current_dir rejects with os error 267 (ERROR_DIRECTORY); this converts them to native form and expands ~.