Skip to content

fix(claude): honor disable_parallel_tool_use#2187

Merged
luispater merged 2 commits intorouter-for-me:devfrom
Darley-Wey:fix/claude-disable-parallel-tool-calls
Mar 17, 2026
Merged

fix(claude): honor disable_parallel_tool_use#2187
luispater merged 2 commits intorouter-for-me:devfrom
Darley-Wey:fix/claude-disable-parallel-tool-calls

Conversation

@Darley-Wey
Copy link
Copy Markdown
Contributor

Summary

  • honor Claude's disable_parallel_tool_use flag when setting Codex parallel_tool_calls
  • default parallel_tool_calls to true only when the client does not send a value
  • add request translation tests for the unset, true, and false cases

Why

Some Claude-compatible clients set disable_parallel_tool_use because they cannot handle a single assistant turn that emits multiple tool_use blocks. If we always force parallel_tool_calls=true, we ignore that capability signal and may return a batched tool-calling response those clients cannot consume.

Copilot AI review requested due to automatic review settings March 17, 2026 11:18
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the Claude-to-Codex request translation mechanism by correctly interpreting the disable_parallel_tool_use flag. This ensures that clients unable to process multiple tool calls in a single response are accommodated, preventing potential compatibility issues and improving the robustness of the API integration.

Highlights

  • Tool Use Translation: Implemented logic to respect Claude's disable_parallel_tool_use flag when translating requests to Codex's parallel_tool_calls parameter.
  • Default Behavior: Adjusted the default behavior for parallel_tool_calls to be true only when the client does not explicitly provide a value for disable_parallel_tool_use.
  • Testing: Added comprehensive request translation tests covering scenarios where disable_parallel_tool_use is unset, true, or false.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • internal/translator/codex/claude/codex_claude_request.go
    • Modified the ConvertClaudeRequestToCodex function to conditionally set parallel_tool_calls based on the presence and value of disable_parallel_tool_use in the incoming Claude request.
  • internal/translator/codex/claude/codex_claude_request_test.go
    • Introduced TestConvertClaudeRequestToCodex_ParallelToolCalls with multiple test cases to validate the correct translation of the disable_parallel_tool_use flag into the parallel_tool_calls parameter.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the Claude-to-Codex request translator to honor the disable_parallel_tool_use flag sent by Claude-compatible clients, instead of always hardcoding parallel_tool_calls=true.

Changes:

  • Read disable_parallel_tool_use from the incoming Claude request and invert it to set parallel_tool_calls accordingly, defaulting to true when absent.
  • Add tests covering the three cases: flag absent, flag true, and flag false.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/translator/codex/claude/codex_claude_request.go Replace hardcoded parallel_tool_calls=true with logic that respects disable_parallel_tool_use
internal/translator/codex/claude/codex_claude_request_test.go Add table-driven tests for the three disable_parallel_tool_use scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly implements support for Claude's disable_parallel_tool_use flag, defaulting to parallel tool calls unless explicitly disabled. The accompanying tests cover the necessary cases. I have one suggestion to make the implementation more concise by leveraging the behavior of the gjson library.

Comment on lines +275 to +278
parallelToolCalls := true
if disableParallelToolUse := rootResult.Get("disable_parallel_tool_use"); disableParallelToolUse.Exists() {
parallelToolCalls = !disableParallelToolUse.Bool()
}
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.

medium

This logic can be made more concise. The gjson.Result.Bool() method returns false for non-existent keys or any value that is not boolean true. You can leverage this to simplify these four lines into a single line.

Suggested change
parallelToolCalls := true
if disableParallelToolUse := rootResult.Get("disable_parallel_tool_use"); disableParallelToolUse.Exists() {
parallelToolCalls = !disableParallelToolUse.Bool()
}
parallelToolCalls := !rootResult.Get("disable_parallel_tool_use").Bool()

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: 19e1a4447a

ℹ️ 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".

Comment on lines +276 to +277
if disableParallelToolUse := rootResult.Get("disable_parallel_tool_use"); disableParallelToolUse.Exists() {
parallelToolCalls = !disableParallelToolUse.Bool()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Read disable_parallel_tool_use from tool_choice

The new lookup reads disable_parallel_tool_use from the top level of the request, but Claude tool-selection options are carried in tool_choice (the repo’s Claude translators consistently parse tool_choice.*, e.g. internal/translator/gemini/claude/gemini_claude_request.go). In requests that set tool_choice.disable_parallel_tool_use=true, this code path is skipped and parallel_tool_calls remains true, so clients that explicitly opt out of parallel tool invocations will still receive parallel tool-use responses.

Useful? React with 👍 / 👎.

@luispater luispater changed the base branch from main to dev March 17, 2026 13:05
@luispater luispater merged commit be3f8db into router-for-me:dev Mar 17, 2026
1 of 2 checks passed
Adamcf123 pushed a commit to Adamcf123/CLIProxyAPI that referenced this pull request Mar 24, 2026
…ble-parallel-tool-calls

fix(claude): honor disable_parallel_tool_use
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants