openclaw - ✅(Solved) Fix sessions_spawn(runtime="subagent") fails with "streamTo is only supported for runtime=acp" [1 pull requests, 4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#61724Fetched 2026-04-08 02:55:23
View on GitHub
Comments
4
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×4

Error Message

return error(`streamTo is only supported for runtime=acp; got runtime=${runtime}`);

  • 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.
  1. Observe immediate error response: 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.

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}\`);
}

Fix Action

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.

PR fix notes

PR #68397: fix(sessions_spawn): silently strip ACP-only fields for runtime=subagent

Description (problem / solution / changelog)

Summary

sessions_spawn currently hard-errors when runtime="subagent" receives streamTo or resumeSessionId, even though the subagent code path never consumes either field. Schema-strict providers (most notably gpt-5.4 via the OpenAI bridge) auto-fill every advertised tool parameter on every call regardless of the runtime value the model also picks, which makes subagent spawns fail 90%+ of the time for those models.

This PR switches the two ACP-only fields from "reject with error" to "silently drop when runtime!=='acp'". ACP semantics are unchanged — when runtime==='acp' the fields flow through unmodified and the existing ACP spawn logic validates them.

Why the silent-drop approach

  • The subagent branch never reads streamTo / resumeSessionId, so dropping them has no observable effect on the subagent code path.
  • Schema filtering per-runtime would be the cleaner long-term fix but requires reworking the shared tool-schema pipeline (tracked in #59225, #66719). Silent-drop unblocks affected users today without that churn.
  • Hard-erroring loses to a predictable failure mode that many downstream models cannot avoid — the model doesn't know the field is ACP-only because the schema doesn't tell it.

Related issues

Addresses (non-exhaustive):

  • #68275 — sessions_spawn auto-injects streamTo:"parent" for runtime="subagent"
  • #67248 — sessions_spawn(runtime="subagent") fails on 2026.4.14 with ACP-only streamTo under GPT-5.4
  • #64714 — sessions_spawn rejects subagent runtime when streamTo is auto-filled by strict-mode providers
  • #63120 — LLMs pass streamTo for subagent runtime causing 100% spawn failures
  • #61724 — sessions_spawn(runtime="subagent") fails with "streamTo is only supported for runtime=acp"
  • #60965 — sessions_spawn schema allows streamTo for runtime=subagent but execute rejects it
  • #59390 — unified schema exposes ACP-only streamTo to subagent spawns
  • #56193 — sessions_spawn(runtime="subagent") can receive ACP-only streamTo from tool-call bridge
  • #56326 — sessions_spawn exposes ACP-only fields and breaks runtime=subagent with schema-following models
  • #53370 — Make sessions_spawn more forgiving for ACP-only fields in subagent runtime
  • #43556 — Bug: streamTo in sessions_spawn breaks subagent runtime

Test plan

  • Updated existing rejects resumeSessionId without runtime=acp and rejects streamTo when runtime is not "acp" cases to assert the new silent-drop contract: the tool forwards to spawnSubagentDirect without the ACP-only keys and returns no error.
  • Unchanged: runtime=acp path still passes streamTo / resumeSessionId through to spawnAcpDirect (existing tests at lines 177, 226 still cover this).
  • Suggested: add an integration test that round-trips a runtime="subagent" call with streamTo="parent" through the tool-call bridge to catch future regressions at the schema layer.

Changed files

  • src/agents/tools/sessions-spawn-tool.test.ts (modified, +14/-10)
  • src/agents/tools/sessions-spawn-tool.ts (modified, +9/-16)

Code Example

streamTo is only supported for runtime=acp; got runtime=subagent

---

const streamTo = params.streamTo === "parent" ? "parent" : void 0;
// Missing guard: should be
const streamTo = params.streamTo === "parent" && runtime === "acp" ? "parent" : void 0;

---

if (streamTo && runtime !== "acp") {
  return error(\`streamTo is only supported for runtime=acp; got runtime=\${runtime}\`);
}
RAW_BUFFERClick to expand / collapse

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

  1. Have an active OpenClaw agent session
  2. Call `sessions_spawn` with default runtime (or explicit `runtime: "subagent"`): ```javascript sessions_spawn({ task: "Return "subagent alive"", runtime: "subagent", mode: "run" }) ```
  3. 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.

extent analysis

TL;DR

The most likely fix is to add a guard to the streamTo assignment to check if the runtime is "acp" before injecting streamTo: "parent".

Guidance

  • Identify the implicitStreamToParent function and modify the streamTo assignment to include a check for runtime === "acp".
  • Verify the fix by calling sessions_spawn with the default runtime: "subagent" and checking that the error is no longer thrown.
  • Consider patching all relevant pi-embedded-* bundles to ensure the fix is comprehensive.
  • Be aware that using runtime: "acp" as a workaround may not be equivalent to using runtime: "subagent" due to differences in execution environments.

Example

const streamTo = params.streamTo === "parent" && runtime === "acp" ? "parent" : void 0;

Notes

The fix requires modifying the compiled pi-embedded-* bundles, which may vary by installation. A partial workaround may not be sufficient, and a comprehensive fix across all relevant files is recommended.

Recommendation

Apply the workaround by adding the && runtime === "acp" guard to the streamTo assignment, as this is a targeted fix that addresses the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix sessions_spawn(runtime="subagent") fails with "streamTo is only supported for runtime=acp" [1 pull requests, 4 comments, 3 participants]