Skip to content

fix: ignore ACP-only streamTo for subagent spawns#40102

Closed
1034378361 wants to merge 1 commit into
openclaw:mainfrom
1034378361:fix/sessions-spawn-streamto-acp-only
Closed

fix: ignore ACP-only streamTo for subagent spawns#40102
1034378361 wants to merge 1 commit into
openclaw:mainfrom
1034378361:fix/sessions-spawn-streamto-acp-only

Conversation

@1034378361

Copy link
Copy Markdown

Summary

Fix sessions_spawn so ACP-only streamTo no longer breaks normal subagent runs.

In 2026.3.7, streamTo became visible on the general sessions_spawn surface, but runtime validation still rejects it unless runtime="acp". In practice this caused subagent spawns to fail with:

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

That was especially easy to hit when tool callers or model-generated calls treated streamTo as a generic optional field on sessions_spawn.

This change keeps ACP behavior intact while making subagent spawns tolerant:

  • runtime="acp" keeps using streamTo normally
  • runtime="subagent" ignores streamTo for compatibility instead of returning an error
  • docs now mark streamTo as ACP-only and explicitly note that subagent runtime ignores it

Why this approach

This is intentionally a compatibility fix, not a feature removal.

streamTo is still a valid ACP feature and should remain available for ACP session flows. The bug was that the shared sessions_spawn surface exposed the field broadly while runtime treated it as ACP-only. Ignoring it on subagent runs is the safest behavior for existing callers and avoids breaking ACP.

Tests

Passed:

node $(find node_modules -path '*/vitest/vitest.mjs' | head -n 1) run src/agents/tools/sessions-spawn-tool.test.ts src/agents/openclaw-tools.sessions.test.ts

Results:

  • src/agents/tools/sessions-spawn-tool.test.ts
  • src/agents/openclaw-tools.sessions.test.ts

Files changed

  • src/agents/tools/sessions-spawn-tool.ts
  • src/agents/tools/sessions-spawn-tool.test.ts
  • docs/tools/index.md

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: XS labels Mar 8, 2026
@greptile-apps

greptile-apps Bot commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a regression introduced in 2026.3.7 where streamTo appearing on the shared sessions_spawn surface caused subagent spawns to fail with a hard error when the field was present but runtime was not "acp". The fix converts that error into a silent ignore for non-ACP runtimes, keeping ACP behavior intact.

Key changes:

  • sessions-spawn-tool.ts: Resolves streamTo to undefined for non-ACP runtimes, eliminating the guard that previously returned a runtime error.
  • sessions-spawn-tool.test.ts: Adds a test verifying successful subagent execution when streamTo is present but runtime is not "acp".
  • docs/tools/index.md: Marks streamTo as ACP-only and notes that subagent runtime ignores it for compatibility.

The fix is minimal, targeted, and safe—it simply makes the system tolerant of a field that shouldn't affect subagent behavior, while preserving full ACP support.

Confidence Score: 5/5

  • Safe to merge — the change is minimal and targeted, converting a hard error into a silent ignore for non-ACP runtimes while preserving full ACP support.
  • The implementation is straightforward: streamTo resolution now depends on runtime, yielding undefined for subagent spawns. The removed guard was redundant since streamTo is not forwarded to spawnSubagentDirect anyway. Test suite covers both the new subagent-ignore path and existing ACP-passes-streamTo path. No correctness issues identified.
  • No files require special attention

Last reviewed commit: 88cae38

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Apr 25, 2026
@clawsweeper

clawsweeper Bot commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

Closing this as duplicate or superseded after Codex automated review.

Close #40102 as superseded by open PR #68397. Current main still has the runtime=subagent failure, so this is not implemented-on-main, but #68397 is the broader canonical fix: it strips both ACP-only streamTo and the adjacent resumeSessionId field for subagent spawns while preserving ACP behavior and updating regression tests.

Best possible solution:

Close #40102 as superseded and keep the remaining review/landing work on #68397, which is the broader canonical fix for ACP-only fields on runtime="subagent" while preserving ACP semantics.

What I checked:

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Codex Review notes: model gpt-5.5, reasoning high; reviewed against d54d2d6b9b8a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation size: XS stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant