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.
claude via acpx)
- Have an LLM agent call
sessions_spawn with runtime="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.
claude via acpx backend)
- Have an LLM agent call the
sessions_spawn tool with runtime="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
Bug type
Regression (worked before, now fails)
Summary
Version
OpenClaw 2026.3.8
Description
The
sessions_spawnLLM tool fails when spawning ACP sessions with:This was introduced in 3.8 by the "ACP spawned-session lineage" feature (CHANGELOG #40137). The
/acp spawnDiscord command works fine — only thesessions_spawntool path is affected.Root cause
spawnAcpDirect()(called bysessions_spawn) passesspawnedBy: requesterInternalKeytosessions.patch:However, the validation in
sessions.patchonly allowsspawnedByforsubagent:*session keys:ACP session keys have the format
agent:{id}:acp:{uuid}, which doesn't match thesubagent:prefix check.The same issue applies to the
spawnDepthvalidation immediately below.Why
/acp spawnworkshandleAcpSpawnAction(the Discord command handler) callssessions.patchwithoutspawnedBy, so it bypasses this validation entirely.Fix suggestion
isAcpSessionKey()already exists insession-key-*.js(exported asS) and correctly matchesacp:*session keys. The validation should accept both:Same for the
spawnDepthcheck a few lines below.Reproduction
claudeviaacpx)sessions_spawnwithruntime="acp",agentId="claude",thread=true,mode="session"spawnedBy is only supported for subagent:* sessionsUsing
/acp spawn claudefrom Discord works as expected.Workaround
Patch the two
gateway-cli-*.jsfiles to addisAcpSessionKeyto the import and validation. Must clearNODE_COMPILE_CACHEand restart after patching.Steps to reproduce
Steps to reproduce:
claudeviaacpxbackend)sessions_spawntool withruntime="acp",agentId="claude",thread=true,mode="session"spawnedBy is only supported for subagent:* sessionsNote:
/acp spawn claude(Discord command) works fine — only thesessions_spawntool path is affected.Expected behavior:
sessions_spawnshould successfully create an ACP session and bind it to a Discord thread, the same way/acp spawndoes. ThespawnedByvalidation in
sessions.patchshould accept ACP session keys (agent:{id}:acp:{uuid}) in addition to subagent keys.Expected behavior
sessions_spawnshould successfully create an ACP session and bind it to a Discord thread, the same way/acp spawndoes.Actual behavior
sessions.patchrejects withspawnedBy is only supported for subagent:* sessionsbecause the validation only checksisSubagentSessionKey()but notisAcpSessionKey(). ACP session keys have formatagent:{id}:acp:{uuid}which doesn't match thesubagent: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