openclaw - ✅(Solved) Fix Feature: Per-agent tool schema parameter filtering (slim tool definitions for subagents) [1 pull requests, 1 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#59225Fetched 2026-04-08 02:27:16
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Fix Action

Fix / Workaround

When non-main agents (e.g., a mechanical dispatcher agent) call sessions_spawn, every model fills in ALL optional parameters from the tool schema — sandbox, streamTo, attachAs, cleanup, attachments, runtime, label, thread, model, thinking, cwd — even when explicitly instructed not to in the agent's workspace files (AGENTS.md, SOUL.md).

{
  "agents": {
    "list": [
      {
        "id": "dispatcher",
        "tools": {
          "sessions_spawn": {
            "allowedParams": ["task", "agentId", "mode", "runTimeoutSeconds"]
          }
        }
      }
    ]
  }
}
  • OpenClaw: latest
  • Models tested: openrouter/x-ai/grok-4-fast, openrouter/xiaomi/mimo-v2-pro
  • Use case: Mechanical dispatcher agent that only needs 4 params for sessions_spawn

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

{
  "agents": {
    "list": [
      {
        "id": "dispatcher",
        "tools": {
          "sessions_spawn": {
            "allowedParams": ["task", "agentId", "mode", "runTimeoutSeconds"]
          }
        }
      }
    ]
  }
}

---

{
  "tools": {
    "sessions_spawn": {
      "deniedParams": ["streamTo", "sandbox", "attachAs", "cleanup", "attachments"]
    }
  }
}
RAW_BUFFERClick to expand / collapse

Problem

When non-main agents (e.g., a mechanical dispatcher agent) call sessions_spawn, every model fills in ALL optional parameters from the tool schema — sandbox, streamTo, attachAs, cleanup, attachments, runtime, label, thread, model, thinking, cwd — even when explicitly instructed not to in the agent's workspace files (AGENTS.md, SOUL.md).

Tested with: Grok 4 Fast, MiMo v2 Pro — both add the same extra parameters on every call, ignoring negative examples in the system prompt. This appears to be a fundamental model behavior: when the tool schema lists optional properties, models fill them in.

Impact:

  • Extra tokens per call (~200-400 tokens wasted per sessions_spawn invocation)
  • Potential for harmful parameter combinations (e.g., streamTo: "parent" causes errors in some contexts)
  • No amount of prompt engineering fixes this — models see the schema and fill it in

Proposed Solution

Allow per-agent tool schema parameter filtering in openclaw.json:

{
  "agents": {
    "list": [
      {
        "id": "dispatcher",
        "tools": {
          "sessions_spawn": {
            "allowedParams": ["task", "agentId", "mode", "runTimeoutSeconds"]
          }
        }
      }
    ]
  }
}

When allowedParams is set, OpenClaw strips all other properties from the tool's JSON schema before sending it to the model. The model never sees the optional parameters, so it can't fill them in.

Alternative: deniedParams

{
  "tools": {
    "sessions_spawn": {
      "deniedParams": ["streamTo", "sandbox", "attachAs", "cleanup", "attachments"]
    }
  }
}

Related Issues

  • #28397 — Slim tool schemas (general token reduction)
  • #47583 — Per-agent tools config
  • #44253 — Per-agent tool inheritance

Environment

  • OpenClaw: latest
  • Models tested: openrouter/x-ai/grok-4-fast, openrouter/xiaomi/mimo-v2-pro
  • Use case: Mechanical dispatcher agent that only needs 4 params for sessions_spawn

extent analysis

TL;DR

Implement per-agent tool schema parameter filtering in openclaw.json to prevent models from filling in unnecessary optional parameters.

Guidance

  • Review the proposed solution and consider adding an allowedParams or deniedParams section to the openclaw.json file to filter out unwanted parameters.
  • Test the alternative deniedParams approach if allowedParams is not feasible.
  • Verify that the model no longer fills in unnecessary parameters after implementing the filtering solution.
  • Check related issues (#28397, #47583, #44253) for potential additional optimizations and configurations.

Example

{
  "agents": {
    "list": [
      {
        "id": "dispatcher",
        "tools": {
          "sessions_spawn": {
            "allowedParams": ["task", "agentId", "mode", "runTimeoutSeconds"]
          }
        }
      }
    ]
  }
}

Notes

The solution assumes that the openclaw.json file is properly configured and that the models are correctly integrated with the OpenClaw system. Additional testing and verification may be necessary to ensure the filtering solution works as expected.

Recommendation

Apply the workaround by implementing per-agent tool schema parameter filtering in openclaw.json, as it provides a direct solution to the problem and can help reduce unnecessary token usage and potential errors.

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