Summary
session_spawn(runtime="acp", agentId="claude", mode="run") is accepted, but the child ACP session history stays empty and no result is written back.
In our environment, direct acpx -> claude works, and Claude/AnyRouter auth is already correctly configured. The remaining failure appears to be in OpenClaw ACP run-mode result persistence / readback for Claude.
Environment
- OpenClaw: 2026.3.2
- Node: 22.22.0
- OS: Linux x64 (Ubuntu)
- acpx backend: bundled plugin-local acpx
- Claude Code: 2.1.62
- Claude routing: AnyRouter via
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_BASE_URL=https://anyrouter.top
What works
1) Direct Claude Code CLI
Running local claude with the same AnyRouter env works.
2) Direct acpx -> claude
Running acpx claude exec 'Reply with exactly ACPX_OK' works when the same Anthropic env is present.
3) Gateway service env is correct
We persisted the Claude/AnyRouter env into the openclaw-gateway systemd user service and confirmed the running gateway process includes:
ANTHROPIC_AUTH_TOKEN
ANTHROPIC_BASE_URL
MAX_THINKING_TOKENS
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
CLAUDE_CODE_ATTRIBUTION_HEADER
What fails
Using sessions_spawn with ACP Claude one-shot run:
{
"task": "Reply with exactly: ACP_CLAUDE_OK",
"runtime": "acp",
"agentId": "claude",
"mode": "run",
"cwd": "/home/ubuntu/.openclaw/workspace",
"timeoutSeconds": 300
}
Response is accepted, e.g.:
{
"status": "accepted",
"childSessionKey": "agent:claude:acp:<uuid>",
"runId": "<uuid>",
"mode": "run",
"note": "initial ACP task queued in isolated session; follow-ups continue in the bound thread."
}
But then:
sessions_history(childSessionKey) returns an empty message list
- no assistant output is ever visible
- no usable child result is written back
Additional observations
Earlier failure mode
Before fixing gateway env inheritance for Claude/AnyRouter, gateway logs showed:
AcpRuntimeError: acpx exited with code 1
code=ACP_TURN_FAILED
That part is now fixed by persisting Anthropic env into the gateway service.
Current failure mode
After env fix + killing lingering claude processes + restarting gateway:
- ACP Claude runs are still accepted
- but
sessions_history remains empty
- and we no longer see the previous
ACP_TURN_FAILED / acpx exited with code 1 error
So the remaining issue looks more like:
- ACP
mode:"run" accepted the task
- but result persistence / assistant reply readback for Claude never lands in the child session history
Likely direction
While debugging the built code, it looks like ACP spawn/run flow differs from native subagent flow:
- subagent path explicitly registers run state and has result readback helpers
- ACP path appears to return
accepted after dispatching the agent message, but result visibility for Claude run-mode may be incomplete / broken in this path
This may be:
- a Claude-specific ACP runtime integration bug,
- a run-mode result writeback bug,
- or a related regression around ACP child session history population.
Related issue
This may be related to #28786, but our current symptom is slightly different:
- not just immediate
ACP_TURN_FAILED
- now the task is accepted, yet child session history stays empty
Repro steps
- Configure ACP backend
acpx
- Ensure
agentId="claude" is allowed
- Persist Anthropic/Claude env into the
openclaw-gateway service
- Restart gateway
- Call
sessions_spawn(runtime="acp", agentId="claude", mode="run")
- Inspect returned
childSessionKey
- Call
sessions_history(childSessionKey)
Actual result
Accepted ACP Claude run, but empty child history and no assistant result.
Expected result
The child ACP Claude session should contain assistant output, and one-shot run results should be readable from session history / normal result plumbing.
Summary
session_spawn(runtime="acp", agentId="claude", mode="run")is accepted, but the child ACP session history stays empty and no result is written back.In our environment, direct
acpx -> claudeworks, and Claude/AnyRouter auth is already correctly configured. The remaining failure appears to be in OpenClaw ACP run-mode result persistence / readback for Claude.Environment
ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URL=https://anyrouter.topWhat works
1) Direct Claude Code CLI
Running local
claudewith the same AnyRouter env works.2) Direct
acpx -> claudeRunning
acpx claude exec 'Reply with exactly ACPX_OK'works when the same Anthropic env is present.3) Gateway service env is correct
We persisted the Claude/AnyRouter env into the
openclaw-gatewaysystemd user service and confirmed the running gateway process includes:ANTHROPIC_AUTH_TOKENANTHROPIC_BASE_URLMAX_THINKING_TOKENSCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICCLAUDE_CODE_ATTRIBUTION_HEADERWhat fails
Using
sessions_spawnwith ACP Claude one-shot run:{ "task": "Reply with exactly: ACP_CLAUDE_OK", "runtime": "acp", "agentId": "claude", "mode": "run", "cwd": "/home/ubuntu/.openclaw/workspace", "timeoutSeconds": 300 }Response is accepted, e.g.:
{ "status": "accepted", "childSessionKey": "agent:claude:acp:<uuid>", "runId": "<uuid>", "mode": "run", "note": "initial ACP task queued in isolated session; follow-ups continue in the bound thread." }But then:
sessions_history(childSessionKey)returns an empty message listAdditional observations
Earlier failure mode
Before fixing gateway env inheritance for Claude/AnyRouter, gateway logs showed:
AcpRuntimeError: acpx exited with code 1code=ACP_TURN_FAILEDThat part is now fixed by persisting Anthropic env into the gateway service.
Current failure mode
After env fix + killing lingering
claudeprocesses + restarting gateway:sessions_historyremains emptyACP_TURN_FAILED/acpx exited with code 1errorSo the remaining issue looks more like:
mode:"run"accepted the taskLikely direction
While debugging the built code, it looks like ACP spawn/run flow differs from native subagent flow:
acceptedafter dispatching the agent message, but result visibility for Claude run-mode may be incomplete / broken in this pathThis may be:
Related issue
This may be related to #28786, but our current symptom is slightly different:
ACP_TURN_FAILEDRepro steps
acpxagentId="claude"is allowedopenclaw-gatewayservicesessions_spawn(runtime="acp", agentId="claude", mode="run")childSessionKeysessions_history(childSessionKey)Actual result
Accepted ACP Claude run, but empty child history and no assistant result.
Expected result
The child ACP Claude session should contain assistant output, and one-shot run results should be readable from session history / normal result plumbing.