Bug Description
`sessions_spawn` with `runtime: "subagent"` (the default runtime) immediately throws:
streamTo is only supported for runtime=acp; got runtime=subagent
This happens even when `streamTo` is not explicitly passed in the call. An internal ACP function `implicitStreamToParent` auto-injects `streamTo: "parent"` into subagent spawn calls under certain session conditions, and then the schema validation rejects it because `streamTo: "parent"` is only supported for `runtime: "acp"`.
Root Cause
In the ACP layer, the `implicitStreamToParent` function decides whether to inject `streamTo: "parent"` based on session characteristics. The logic does not check the child `runtime` before injecting. When `runtime === "subagent"`, the injected `streamTo: "parent"` reaches the validation layer, which then throws because `streamTo` is only valid for `runtime === "acp"`.
The injection happens upstream at:
const streamTo = params.streamTo === "parent" ? "parent" : void 0;
// Missing guard: should be
const streamTo = params.streamTo === "parent" && runtime === "acp" ? "parent" : void 0;
The validation that throws:
if (streamTo && runtime !== "acp") {
return error(\`streamTo is only supported for runtime=acp; got runtime=\${runtime}\`);
}
Impact
- All `sessions_spawn` calls fail at the tool-entry level — no sub-agent can be spawned via the default `runtime="subagent"`.
- Users must fall back to `runtime: "acp"` — which changes the execution environment (ACP harness vs native subagent) and may not be a viable workaround for all use cases.
- The error is silent in some contexts: `sessions_spawn` returns the error object rather than throwing a visible exception, so it may appear as a tool-call failure rather than a runtime bug.
Workaround
Use `runtime: "acp"` instead of `runtime: "subagent"`. However, this is not always equivalent — ACP runs an external harness (Codex/Claude/Gemini) while subagent runs the native OpenClaw agent runtime.
Environment
- OpenClaw v2026.4.5
- macOS / Linux (all platforms)
- Affects all channels (Telegram, Discord, Feishu, WebChat, etc.)
Steps to Reproduce
- Have an active OpenClaw agent session
- Call `sessions_spawn` with default runtime (or explicit `runtime: "subagent"`):
```javascript
sessions_spawn({
task: "Return "subagent alive"",
runtime: "subagent",
mode: "run"
})
```
- Observe immediate error response:
```
streamTo is only supported for runtime=acp; got runtime=subagent
```
Expected Behavior
Sub-agents should spawn normally without this error. The `streamTo` parameter (or its auto-injected equivalent) should be ignored for `runtime="subagent"` calls, not rejected.
Files Affected (v2026.4.5)
Patch required in the compiled `pi-embedded-*` bundles. The fix is adding `&& runtime === "acp"` guard to the streamTo assignment. Example file (path varies by install hash):
- `dist/pi-embedded-DWASRjxE.js` (line ~16609)
- `dist/pi-embedded-bukGSgEe.js`
The injection point `implicitStreamToParent` is in the ACP control plane and affects any subagent spawn call when certain session conditions are met.
Additional Context
- This bug was first observed on 2026-03-27 and has been reproduced across multiple OpenClaw installations.
- The `implicitStreamToParent` logic is designed to auto-route ACP progress streams back to the parent session, but it should not apply this to native subagent runs.
- A partial workaround (patching only one bundle file) was found to be insufficient — the validation logic exists in multiple compiled bundles, requiring a comprehensive fix across all relevant files.
Bug Description
`sessions_spawn` with `runtime: "subagent"` (the default runtime) immediately throws:
This happens even when `streamTo` is not explicitly passed in the call. An internal ACP function `implicitStreamToParent` auto-injects `streamTo: "parent"` into subagent spawn calls under certain session conditions, and then the schema validation rejects it because `streamTo: "parent"` is only supported for `runtime: "acp"`.
Root Cause
In the ACP layer, the `implicitStreamToParent` function decides whether to inject `streamTo: "parent"` based on session characteristics. The logic does not check the child `runtime` before injecting. When `runtime === "subagent"`, the injected `streamTo: "parent"` reaches the validation layer, which then throws because `streamTo` is only valid for `runtime === "acp"`.
The injection happens upstream at:
The validation that throws:
Impact
Workaround
Use `runtime: "acp"` instead of `runtime: "subagent"`. However, this is not always equivalent — ACP runs an external harness (Codex/Claude/Gemini) while subagent runs the native OpenClaw agent runtime.
Environment
Steps to Reproduce
```javascript
sessions_spawn({
task: "Return "subagent alive"",
runtime: "subagent",
mode: "run"
})
```
```
streamTo is only supported for runtime=acp; got runtime=subagent
```
Expected Behavior
Sub-agents should spawn normally without this error. The `streamTo` parameter (or its auto-injected equivalent) should be ignored for `runtime="subagent"` calls, not rejected.
Files Affected (v2026.4.5)
Patch required in the compiled `pi-embedded-*` bundles. The fix is adding `&& runtime === "acp"` guard to the streamTo assignment. Example file (path varies by install hash):
The injection point `implicitStreamToParent` is in the ACP control plane and affects any subagent spawn call when certain session conditions are met.
Additional Context