Skip to content

fix(tools): add acp-only guidance to sessions_spawn streamTo parameter#63121

Closed
SuperSupeng wants to merge 2 commits into
openclaw:mainfrom
SuperSupeng:fix/sessions-spawn-streamto-description
Closed

fix(tools): add acp-only guidance to sessions_spawn streamTo parameter#63121
SuperSupeng wants to merge 2 commits into
openclaw:mainfrom
SuperSupeng:fix/sessions-spawn-streamto-description

Conversation

@SuperSupeng

Copy link
Copy Markdown

Summary

  • Add description to streamTo schema field in sessions_spawn tool, explicitly stating it requires runtime="acp" and must not be set for runtime="subagent"
  • Update describeSessionsSpawnTool() to list which params are subagent-safe vs acp-only
  • Add test verifying the schema description contains acp guidance

Closes #63120

Context

LLMs using sessions_spawn consistently pass streamTo: "parent" even when runtime is "subagent", because nothing in the schema tells them it's acp-only. This causes 100% spawn failures in multi-agent setups. Other acp-only params like resumeSessionId already have descriptions stating the requirement — streamTo was the only one missing this guidance.

Test plan

  • Existing sessions-spawn-tool.test.ts tests pass (13/13)
  • New test verifies streamTo schema description mentions both "acp" and "subagent"
  • Manual verification: the runtime validation at L195 remains unchanged (defense in depth)

🤖 Generated with Claude Code
via Happy

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Apr 8, 2026
@greptile-apps

greptile-apps Bot commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a common LLM failure mode where streamTo: \"parent\" was being set for runtime=\"subagent\" spawns (causing 100% spawn failures) by adding an explicit description to the streamTo schema field and updating the tool's prose description with acp-only guidance — matching the existing pattern on resumeSessionId.

The schema fix and new test are clean. The one P2 concern is in the updated tool description, which lists only task, agentId, and runTimeoutSeconds as subagent-safe params; this is overly restrictive since other params (model, cwd, lightContext, attachments, etc.) are perfectly valid for subagent spawns and may now be silently skipped by models following the guidance.

Confidence Score: 5/5

Safe to merge; the core schema fix is correct and the only remaining finding is a P2 wording issue in the tool description prose.

The primary fix (adding a description to the streamTo schema field) is correct, minimal, and follows the existing resumeSessionId pattern. The new test provides adequate coverage. The single P2 comment about the overly-restrictive param allowlist in the prose description does not affect correctness or runtime behavior.

src/agents/tool-description-presets.ts — the new guidance sentence's subagent param allowlist may be too narrow.

Vulnerabilities

No security concerns identified.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/agents/tool-description-presets.ts
Line: 40

Comment:
**Overly restrictive subagent param list**

The guidance says "only pass `task`, `agentId`, and `runTimeoutSeconds`" for subagent spawns, but several other schema params are valid and useful for subagents — `model`, `thinking`, `cwd`, `mode`, `sandbox`, `lightContext`, `attachments`, `label`, etc. Restricting the guidance to three params may cause models to silently omit useful options like `cwd` or `model` when spawning subagents.

Consider tightening the guidance to just the "do not set" prohibition instead of an allowlist:

```suggestion
    'For subagent spawns, do not set streamTo or resumeSessionId — those require runtime="acp".',
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(tools): add acp-only guidance to ses..." | Re-trigger Greptile

Comment thread src/agents/tool-description-presets.ts Outdated
'`mode="run"` is one-shot and `mode="session"` is persistent or thread-bound.',
"Subagents inherit the parent workspace directory automatically.",
"Use this when the work should happen in a fresh child session instead of the current one.",
'For subagent spawns, only pass task, agentId, and runTimeoutSeconds. Do not set streamTo or resumeSessionId — those require runtime="acp".',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Overly restrictive subagent param list

The guidance says "only pass task, agentId, and runTimeoutSeconds" for subagent spawns, but several other schema params are valid and useful for subagents — model, thinking, cwd, mode, sandbox, lightContext, attachments, label, etc. Restricting the guidance to three params may cause models to silently omit useful options like cwd or model when spawning subagents.

Consider tightening the guidance to just the "do not set" prohibition instead of an allowlist:

Suggested change
'For subagent spawns, only pass task, agentId, and runTimeoutSeconds. Do not set streamTo or resumeSessionId — those require runtime="acp".',
'For subagent spawns, do not set streamTo or resumeSessionId — those require runtime="acp".',
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agents/tool-description-presets.ts
Line: 40

Comment:
**Overly restrictive subagent param list**

The guidance says "only pass `task`, `agentId`, and `runTimeoutSeconds`" for subagent spawns, but several other schema params are valid and useful for subagents — `model`, `thinking`, `cwd`, `mode`, `sandbox`, `lightContext`, `attachments`, `label`, etc. Restricting the guidance to three params may cause models to silently omit useful options like `cwd` or `model` when spawning subagents.

Consider tightening the guidance to just the "do not set" prohibition instead of an allowlist:

```suggestion
    'For subagent spawns, do not set streamTo or resumeSessionId — those require runtime="acp".',
```

How can I resolve this? If you propose a fix, please make it concise.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 380078f2b2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/tool-description-presets.ts Outdated
'`mode="run"` is one-shot and `mode="session"` is persistent or thread-bound.',
"Subagents inherit the parent workspace directory automatically.",
"Use this when the work should happen in a fresh child session instead of the current one.",
'For subagent spawns, only pass task, agentId, and runTimeoutSeconds. Do not set streamTo or resumeSessionId — those require runtime="acp".',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove misleading subagent parameter restriction in description

The new guidance says subagent spawns should "only pass task, agentId, and runTimeoutSeconds," but the implementation still supports additional subagent fields (mode, thread, cleanup, sandbox, model, thinking, attachments, etc. in sessions_spawn). In practice, models that follow this text will stop sending those valid parameters, which can silently disable intended behaviors like persistent/thread-bound sessions or model overrides for subagent runs; this should be narrowed to only prohibit the ACP-only fields (streamTo, resumeSessionId).

Useful? React with 👍 / 👎.

SuperSupeng and others added 2 commits April 10, 2026 13:48
LLMs using sessions_spawn tend to pass streamTo: "parent" even when
runtime is "subagent", causing 100% spawn failures because the
validation rejects streamTo for non-acp runtimes. This happens because
the streamTo schema field has no description indicating it is acp-only,
so the model treats it as a generally useful option.

This change:
- Adds a description to the streamTo schema field stating it requires
  runtime="acp" and must not be set for runtime="subagent"
- Updates the tool description to explicitly list which params are
  subagent-safe and which require acp
- Adds a test verifying the schema description contains acp guidance

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>
Address review feedback: the previous wording "only pass task, agentId,
and runTimeoutSeconds" was overly restrictive and could cause LLMs to
skip valid subagent params like model, cwd, attachments, etc. Changed
to a prohibit-list approach: "do not set streamTo or resumeSessionId".

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <[email protected]>
Co-Authored-By: Happy <[email protected]>
@clawsweeper

clawsweeper Bot commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

Codex automated review: keeping this open.

Keep this PR open. Current main still lacks the proposed streamTo ACP-only schema description and still rejects streamTo on runtime="subagent"; the same-author paired issue #63120 remains open, and maintainer replacement #72331 is still the broader open fix path rather than a landed implementation.

Best possible solution:

Keep this PR open for maintainer handling. The best product path is to review and land #72331, or an equivalent maintainer-approved fix that adds clear ACP-only schema/tool guidance and tolerates ACP-only fields for native subagent calls; after that lands, explicitly close or supersede this PR while preserving SuperSupeng’s reproduction and schema-guidance contribution.

What I checked:

Remaining risk / open question:

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

@openclaw-clownfish

Copy link
Copy Markdown
Contributor

Thanks @SuperSupeng for the focused schema-guidance PR and the paired reproduction in #63120. I am closing this as superseded by #72614 because that landed the canonical sessions_spawn fix: subagent runtime now tolerates ACP-only streamTo/resumeSessionId fields, ACP behavior is preserved, and the schema/docs path was updated alongside regression coverage.

Clownfish is carrying the attribution from this source PR in the closeout trail with #63120 and #72614. If the schema guidance in #72614 still leaves a distinct provider case uncovered, please reply here and we can reopen or split it back out.

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

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sessions_spawn: LLMs pass streamTo for subagent runtime causing 100% spawn failures

1 participant