Skip to content

agents: scope parallel_tool_calls to OpenAI-compatible payloads#37261

Closed
cgdusek wants to merge 10 commits intoopenclaw:mainfrom
cgdusek:codex/issue-37048-parallel-tool-calls-scope
Closed

agents: scope parallel_tool_calls to OpenAI-compatible payloads#37261
cgdusek wants to merge 10 commits intoopenclaw:mainfrom
cgdusek:codex/issue-37048-parallel-tool-calls-scope

Conversation

@cgdusek
Copy link
Copy Markdown
Contributor

@cgdusek cgdusek commented Mar 6, 2026

Summary

  • scope parallel_tool_calls payload injection to OpenAI-compatible request APIs only (openai-completions, openai-responses)
  • support both params.parallel_tool_calls and params.parallelToolCalls
  • ignore and warn on invalid non-boolean values instead of mutating payloads
  • add regression tests for supported injection, unsupported API no-op, invalid value handling, and no-config behavior

Why

Issue #37048 reports a high-impact regression where models that reject parallel tool calls return 400 and break tool execution. Existing proposals added payload injection but did not guard API compatibility. This patch keeps the fix while preventing accidental injection into strict non-OpenAI schemas.

Validation

  • pnpm vitest run src/agents/pi-embedded-runner-extraparams.test.ts
  • pnpm build
  • pnpm check currently fails in this branch due pre-existing unrelated type errors:
    • src/gateway/openai-http.ts(303,48)
    • src/gateway/server-methods/chat.ts(938,9)

Related

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 6, 2026

Greptile Summary

This PR scopes parallel_tool_calls payload injection to OpenAI-compatible APIs (openai-completions, openai-responses) to fix a regression (#37048) where models rejecting the field returned HTTP 400s. It also adds support for the camelCase alias parallelToolCalls, validates that only boolean values are accepted (warning and ignoring otherwise), and includes thorough regression tests.

Key strengths:

  • resolveParallelToolCalls correctly handles both parallel_tool_calls and parallelToolCalls with ??-based precedence (snake_case wins) and proper invalid-value guarding.
  • createParallelToolCallsWrapper correctly defers the API-compatibility check to call time, which is the right pattern.
  • Test coverage is solid: covers injection for both openai-completions and openai-responses, no-op for anthropic-messages, invalid-value warning, and unconfigured passthrough.

Issue to address:

  • The debug log on line 1182 fires when the wrapper is created, but the actual injection is deferred and guarded. For non-OpenAI APIs, the log will emit "applying parallel_tool_calls=..." even though injection will be silently skipped, which could confuse debugging. Consider moving the log inside the wrapper after the API check to ensure it only fires when injection actually occurs.

Confidence Score: 4/5

  • Safe to merge; the fix is well-scoped, logic is correct, and backed by solid regression tests.
  • The implementation correctly scopes payload injection to OpenAI-compatible APIs only, properly handles both parameter name variants with appropriate validation, and includes comprehensive test coverage for the key scenarios (supported APIs, unsupported API no-op, invalid values). The one identified issue—a misleading debug log that fires even when injection will be skipped—is a clarity concern with no runtime impact and can be fixed with a straightforward refactoring.
  • The debug log at line 1182 in src/agents/pi-embedded-runner/extra-params.ts should be moved inside the wrapper function to only fire when injection actually occurs, preventing confusion during debugging sessions.

Last reviewed commit: ce91a5b

@cgdusek cgdusek force-pushed the codex/issue-37048-parallel-tool-calls-scope branch from ce91a5b to b5216e6 Compare March 6, 2026 06:12
@openclaw-barnacle openclaw-barnacle bot added the gateway Gateway runtime label Mar 6, 2026
@cgdusek

This comment was marked as spam.

Copy link
Copy Markdown

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

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: 508c443821

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cgdusek

This comment was marked as spam.

@cgdusek

This comment was marked as spam.

@cgdusek cgdusek force-pushed the codex/issue-37048-parallel-tool-calls-scope branch from c2b4c0f to ccdb8bf Compare March 6, 2026 06:44
Copy link
Copy Markdown

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

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: ccdb8bf595

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cgdusek

This comment was marked as spam.

@cgdusek cgdusek force-pushed the codex/issue-37048-parallel-tool-calls-scope branch from b7f5dc7 to e9454c9 Compare March 6, 2026 18:08
@openclaw-barnacle openclaw-barnacle bot added channel: feishu Channel integration: feishu r: too-many-prs labels Mar 6, 2026
@openclaw-barnacle
Copy link
Copy Markdown

Closing this PR because the author has more than 10 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit.

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

Labels

agents Agent runtime and tooling channel: feishu Channel integration: feishu gateway Gateway runtime r: too-many-prs size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Bug] v2026.3.2 sends parallel_tool_calls to models that don't support it (breaks all tools)

1 participant