-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
[Bug]: sessions_spawn tool fails for ACP sessions: "spawnedBy is only supported for subagent:* sessions" #40971
Description
Bug type
Regression (worked before, now fails)
Summary
Version
OpenClaw 2026.3.8
Description
The sessions_spawn LLM tool fails when spawning ACP sessions with:
spawnedBy is only supported for subagent:* sessions
This was introduced in 3.8 by the "ACP spawned-session lineage" feature (CHANGELOG #40137). The /acp spawn Discord command works fine — only the sessions_spawn tool path is affected.
Root cause
spawnAcpDirect() (called by sessions_spawn) passes spawnedBy: requesterInternalKey to sessions.patch:
// compact-D3emcZgv.js:27350
await callGateway({
method: "sessions.patch",
params: {
key: sessionKey,
spawnedBy: requesterInternalKey,
...params.label ? { label: params.label } : {}
},
timeoutMs: 1e4
});However, the validation in sessions.patch only allows spawnedBy for subagent:* session keys:
// gateway-cli-CbAOelvx.js:9050
if (!isSubagentSessionKey(storeKey))
return invalid("spawnedBy is only supported for subagent:* sessions");ACP session keys have the format agent:{id}:acp:{uuid}, which doesn't match the subagent: prefix check.
The same issue applies to the spawnDepth validation immediately below.
Why /acp spawn works
handleAcpSpawnAction (the Discord command handler) calls sessions.patch without spawnedBy, so it bypasses this validation entirely.
Fix suggestion
isAcpSessionKey() already exists in session-key-*.js (exported as S) and correctly matches acp:* session keys. The validation should accept both:
if (!isSubagentSessionKey(storeKey) && !isAcpSessionKey(storeKey))
return invalid("spawnedBy is only supported for subagent:* or acp:* sessions");Same for the spawnDepth check a few lines below.
Reproduction
- Configure an ACP agent (e.g.
claudeviaacpx) - Have an LLM agent call
sessions_spawnwithruntime="acp",agentId="claude",thread=true,mode="session" - Observe the error:
spawnedBy is only supported for subagent:* sessions
Using /acp spawn claude from Discord works as expected.
Workaround
Patch the two gateway-cli-*.js files to add isAcpSessionKey to the import and validation. Must clear NODE_COMPILE_CACHE and restart after patching.
Steps to reproduce
Steps to reproduce:
- Configure an ACP agent (e.g.
claudeviaacpxbackend) - Have an LLM agent call the
sessions_spawntool withruntime="acp",agentId="claude",thread=true,mode="session" - Observe error:
spawnedBy is only supported for subagent:* sessions
Note: /acp spawn claude (Discord command) works fine — only the sessions_spawn tool path is affected.
Expected behavior:
sessions_spawn should successfully create an ACP session and bind it to a Discord thread, the same way /acp spawn does. The spawnedBy
validation in sessions.patch should accept ACP session keys (agent:{id}:acp:{uuid}) in addition to subagent keys.
Expected behavior
sessions_spawn should successfully create an ACP session and bind it to a Discord thread, the same way /acp spawn does.
Actual behavior
sessions.patch rejects with spawnedBy is only supported for subagent:* sessions because the validation only checks
isSubagentSessionKey() but not isAcpSessionKey(). ACP session keys have format agent:{id}:acp:{uuid} which doesn't match the
subagent: prefix.
OpenClaw version
2026.03.08
Operating system
Debian
Install method
npm
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response