openclaw - ✅(Solved) Fix sessions_spawn mishandles subagent streamTo and model=default [1 pull requests, 2 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#72078Fetched 2026-04-27 05:35:12
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×2closed ×1cross-referenced ×1

While using the built-in sessions_spawn tool against an npm-installed OpenClaw 2026.4.22, I hit two user-facing regressions in the tool wrapper for runtime="subagent":

  1. streamTo:"parent" is parsed before runtime gating, so a caller/tooling layer that includes that field causes an immediate tool error for subagent runs:
    • streamTo is only supported for runtime=acp; got runtime=subagent
  2. model:"default" is forwarded as a literal override instead of being normalized to “no explicit override”, which later resolves to an invalid model ref like:
    • model not allowed: openai/default

Both are fixable in the sessions_spawn tool wrapper without changing subagent runtime behavior.

Error Message

  1. streamTo:"parent" is parsed before runtime gating, so a caller/tooling layer that includes that field causes an immediate tool error for subagent runs:

Root Cause

In dist/openclaw-tools-D2PgzZeK.js inside createSessionsSpawnTool(...):

  • streamTo is derived unconditionally from params, then rejected for non-ACP runtime.
  • model is read directly from params and forwarded unchanged, so the sentinel string default becomes a real override candidate.

Fix Action

Fix / Workaround

Notes

I used a local hotfix script against the packaged dist file to confirm the behavior. If useful, I can also turn this into a PR against the source tree once the canonical source file/path is pointed out.

PR fix notes

PR #72101: fix(agents): ignore ACP-only streamTo and treat default model as unset

Description (problem / solution / changelog)

fix(agents): normalize sessions_spawn default model and ACP-only streamTo

Summary

This fixes sessions_spawn behavior mismatches for subagent runtime and model override handling.

Fixes #72078.

Root Cause

  • streamTo was parsed before runtime-specific handling and rejected for any non-ACP call.
  • model: "default" was treated as a literal model override instead of a reset/fallback sentinel.
  • sessions_spawn and session_status handled "default" semantics differently.

What Changed

  • Updated src/agents/tools/sessions-spawn-tool.ts:
    • only materialize streamTo when runtime === "acp"; non-ACP runtimes now ignore it;
    • normalize model: "default" to unset override.
  • Added shared helper in src/agents/tools/common.ts:
    • normalizeToolModelOverride() centralizes model override normalization (empty/default -> undefined).
  • Updated src/agents/tools/session-status-tool.ts:
    • reuse the same normalization helper to keep "default" behavior consistent across tools.
  • Updated src/agents/tools/sessions-spawn-tool.test.ts:
    • renamed and updated the streamTo test to assert ignore behavior for non-ACP runtime;
    • added regression coverage for model: "default" normalization.

Validation

  • pnpm test src/agents/tools/sessions-spawn-tool.test.ts (pass)
  • pnpm test src/agents/openclaw-tools.session-status.test.ts (pass)

Risk / Follow-up

  • Risk is low and scoped to tool-parameter normalization.
  • ACP behavior remains unchanged for runtime="acp" calls.

AI-assisted

  • AI-assisted and manually reviewed.

Changed files

  • src/agents/tools/common.ts (modified, +17/-0)
  • src/agents/tools/session-status-tool.ts (modified, +2/-6)
  • src/agents/tools/sessions-spawn-tool.test.ts (modified, +27/-5)
  • src/agents/tools/sessions-spawn-tool.ts (modified, +8/-11)

Code Example

{
  "runtime": "subagent",
  "task": "Reply with OK",
  "streamTo": "parent",
  "mode": "run",
  "lightContext": true
}

---

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

---

{
  "runtime": "subagent",
  "task": "Reply with OK",
  "mode": "run",
  "lightContext": true,
  "model": "default"
}

---

model not allowed: openai/default

---

const modelOverrideRaw = readStringParam(params, "model");
const modelOverride = modelOverrideRaw === "default" ? undefined : modelOverrideRaw;

const streamTo = runtime === "acp" && params.streamTo === "parent"
  ? "parent"
  : undefined;
RAW_BUFFERClick to expand / collapse

OpenClaw upstream issue draft: sessions_spawn subagent parameter handling

Title

sessions_spawn tool mishandles runtime="subagent" with streamTo:"parent", and wrongly treats model:"default" as a literal model override

Summary

While using the built-in sessions_spawn tool against an npm-installed OpenClaw 2026.4.22, I hit two user-facing regressions in the tool wrapper for runtime="subagent":

  1. streamTo:"parent" is parsed before runtime gating, so a caller/tooling layer that includes that field causes an immediate tool error for subagent runs:
    • streamTo is only supported for runtime=acp; got runtime=subagent
  2. model:"default" is forwarded as a literal override instead of being normalized to “no explicit override”, which later resolves to an invalid model ref like:
    • model not allowed: openai/default

Both are fixable in the sessions_spawn tool wrapper without changing subagent runtime behavior.

Affected version

  • OpenClaw 2026.4.22 (00bd2cf)
  • Install kind: npm package on Windows

Reproduction

Case 1: subagent + streamTo

Call the tool equivalent of:

{
  "runtime": "subagent",
  "task": "Reply with OK",
  "streamTo": "parent",
  "mode": "run",
  "lightContext": true
}

Observed:

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

Expected:

  • For runtime="subagent", ignore ACP-only streamTo instead of failing the spawn.
  • This matters because some caller layers/tool wrappers may always include streamTo:"parent".

Case 2: subagent + model="default"

Call the tool equivalent of:

{
  "runtime": "subagent",
  "task": "Reply with OK",
  "mode": "run",
  "lightContext": true,
  "model": "default"
}

Observed before fix:

model not allowed: openai/default

Expected:

  • model:"default" should be normalized to no explicit override so subagent selection falls back to the configured default model.

Root cause

In dist/openclaw-tools-D2PgzZeK.js inside createSessionsSpawnTool(...):

  • streamTo is derived unconditionally from params, then rejected for non-ACP runtime.
  • model is read directly from params and forwarded unchanged, so the sentinel string default becomes a real override candidate.

Minimal fix

Two targeted wrapper changes were sufficient locally:

  1. Only materialize streamTo when runtime === "acp"
  2. Normalize model === "default" to undefined

Conceptually:

const modelOverrideRaw = readStringParam(params, "model");
const modelOverride = modelOverrideRaw === "default" ? undefined : modelOverrideRaw;

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

Verification

After applying those two wrapper changes locally:

  • runtime:"subagent" spawn succeeds even when streamTo:"parent" is present
  • runtime:"subagent", model:"default" also succeeds and child run completes normally

Notes

I used a local hotfix script against the packaged dist file to confirm the behavior. If useful, I can also turn this into a PR against the source tree once the canonical source file/path is pointed out.

extent analysis

TL;DR

The sessions_spawn tool can be fixed by conditionally handling the streamTo parameter based on the runtime and normalizing the model parameter to handle the "default" case.

Guidance

  • Verify that the streamTo parameter is only materialized when the runtime is "acp" to prevent errors with "subagent" runtime.
  • Normalize the model parameter to handle the "default" case by setting it to undefined when the value is "default".
  • Review the createSessionsSpawnTool function in dist/openclaw-tools-D2PgzZeK.js to ensure the fixes are applied correctly.
  • Test the changes with the provided reproduction cases to ensure the tool behaves as expected.

Example

const modelOverrideRaw = readStringParam(params, "model");
const modelOverride = modelOverrideRaw === "default" ? undefined : modelOverrideRaw;

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

Notes

The provided minimal fix and verification steps suggest that the issue can be resolved with targeted changes to the sessions_spawn tool wrapper.

Recommendation

Apply the workaround by implementing the conditional handling of the streamTo parameter and normalizing the model parameter, as this approach has been verified to resolve 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 mishandles subagent streamTo and model=default [1 pull requests, 2 comments, 3 participants]