Skip to content

bug(core): wait_for_previous is forwarded to MCP and discovered tool arguments #27403

@fallintoplace

Description

@fallintoplace

Summary

wait_for_previous is scheduler metadata, but the runtime forwards it to external tools unchanged. That breaks the external tool contract for strict MCP servers or discovered-tool commands that validate exact input schemas, because they receive an extra property that was not part of the original tool definition.

Related but distinct from #26643: that issue is about default scheduling behavior and redundant parallel calls. This one is about scheduler-only metadata leaking into the payload sent to external tools.

Why this happens

At commit a00d03efc62de08274619cf7da96569ae51ecbf3:

Reachability

This is reachable in normal operation, not dead code:

Reproduction

  1. Register an MCP tool or discovered tool command that validates inputs strictly, for example with additionalProperties: false or equivalent.
  2. Invoke that tool with wait_for_previous: true so the scheduler will sequence it.
  3. Observe that the external tool receives wait_for_previous in its input payload and can reject the call as an unexpected property.

Expected behavior

wait_for_previous should influence scheduler behavior only. It should not be forwarded to external tool implementations.

Actual behavior

The same args object is used both for scheduling and for the payload sent to discovered tools / MCP servers, so scheduler-only metadata leaks across the tool boundary.

Related history

Possible fix

Strip reserved scheduler fields before tool.build(...), or at least before each external executor forwards params to discovered tools and MCP calls.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions