Bug Description
When using sessions_spawn to spawn a subagent with a different agentId, the subagent inherits the parent agent's current working directory (cwd) instead of using the target agent's configured workspace path.
Steps to Reproduce
- Configure two agents with different workspaces:
{
"agents": {
"list": [
{ "id": "main", "workspace": "~/.openclaw/workspace" },
{ "id": "clc-backend", "workspace": "~/.openclaw/workspace-clc-backend" }
]
}
}
- From
main agent, spawn clc-backend:
sessions_spawn(agentId="clc-backend", task="run pwd to show workspace")
- Check the subagent transcript - the
cwd is set to /Users/dylon/.openclaw/workspace (main's workspace) instead of /Users/dylon/.openclaw/workspace-clc-backend.
Expected Behavior
The subagent should start with cwd set to the target agent's configured workspace path.
Actual Behavior
The subagent inherits the parent agent's cwd.
Environment
- OpenClaw version: 2026.3.8
- OS: macOS (Darwin 25.3.0 arm64)
Workaround
Currently need to explicitly cd in the task or use absolute paths.
Bug Description
When using
sessions_spawnto spawn a subagent with a differentagentId, the subagent inherits the parent agent's current working directory (cwd) instead of using the target agent's configuredworkspacepath.Steps to Reproduce
{ "agents": { "list": [ { "id": "main", "workspace": "~/.openclaw/workspace" }, { "id": "clc-backend", "workspace": "~/.openclaw/workspace-clc-backend" } ] } }mainagent, spawnclc-backend:cwdis set to/Users/dylon/.openclaw/workspace(main's workspace) instead of/Users/dylon/.openclaw/workspace-clc-backend.Expected Behavior
The subagent should start with
cwdset to the target agent's configuredworkspacepath.Actual Behavior
The subagent inherits the parent agent's
cwd.Environment
Workaround
Currently need to explicitly
cdin the task or use absolute paths.