gemini-cli - 💡(How to fix) Fix bug(core): `wait_for_previous` is forwarded to MCP and discovered tool arguments

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…

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.

Root Cause

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.

RAW_BUFFERClick to expand / collapse

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

  • #26643 tracks default wait_for_previous behavior causing redundant parallel calls.
  • #17235 and closed PR #21963 are useful precedent for stripping MCP-facing metadata fields for compatibility, but they address $schema, not runtime argument forwarding.

Possible fix

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

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…

FAQ

Expected behavior

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

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING