Skip to content

fix(openai-chat): let opted-out providers pin parallel_tool_calls:false - #1662

Merged
Wibias merged 1 commit into
lidge-jun:devfrom
TooSpace:fix/parallel-tool-calls-pin-false
Aug 14, 2026
Merged

fix(openai-chat): let opted-out providers pin parallel_tool_calls:false#1662
Wibias merged 1 commit into
lidge-jun:devfrom
TooSpace:fix/parallel-tool-calls-pin-false

Conversation

@TooSpace

@TooSpace TooSpace commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What

Add an opt-in provider flag pinParallelToolCallsFalse so an opted-out
openai-chat provider can actually send parallel_tool_calls: false on the
wire, instead of silently omitting it.

Fixes #1650.

Why

In src/adapters/openai-chat.ts, when provider.parallelToolCalls === false the
wire bit parallel_tool_calls: false is only emitted for the NVIDIA NIM
baseUrl. Every other opted-out provider omits the field entirely. For strict
OpenAI-compatible hosts that reject unknown fields this omit-by-default is
correct. But self-hosted gateways in the Kimi/GLM family (and vLLM-style
backends) do honor parallel_tool_calls and, without it, keep emitting
multiple concurrent tool calls in a single streamed turn -- which the Responses
translator then has to reject. parallelToolCalls: false looks like the opt-out
for this, but today it is a no-op for those providers.

Design / why opt-in

The omit-by-default behavior is deliberate and covered by existing tests
(tests/parallel-tool-calls-optin.test.ts: a false provider must NOT emit the
field). Sending parallel_tool_calls: false unconditionally would break those
strict hosts, so the wire bit stays gated:

  • NVIDIA NIM baseUrl: unchanged (still pinned).
  • Any other provider: pinned only when it sets pinParallelToolCallsFalse: true.
  • No effect unless parallelToolCalls === false.

Default behavior for every existing provider is unchanged.

Changes

  • src/types.ts: add documented optional pinParallelToolCallsFalse?: boolean to OcxProviderConfig.
  • src/adapters/openai-chat.ts: OR the new flag into the existing NVIDIA-baseUrl condition that pins the wire bit.
  • tests/parallel-tool-calls-optin.test.ts: cover pinned-false emits the bit, keeps emitting under a permissive request bit, and is a no-op without parallelToolCalls:false.

Testing

  • bun x tsc --noEmit clean on top of dev.
  • bun test for parallel-tool-calls-optin, openai-chat-hardening, openai-chat-parallel-stream, chat-completions-endpoint: 126 pass, 0 fail (includes 3 new cases). Existing omit-by-default assertions still pass.

Review readiness checklist

This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:

  • All CI tests are green on my local testing.

  • I pushed my PR to the latest dev commit.

  • I resolved all correct Codex and CodeRabbit findings.

  • My PR is ready for review.

Summary by CodeRabbit

  • New Features

    • Added provider configuration to explicitly send parallel_tool_calls: false when parallel tool calls are disabled.
    • Supports overriding permissive request-level settings when this option is enabled.
  • Bug Fixes

    • Improved consistency of parallel tool-call settings across supported providers.
    • Providers without the opt-in configuration remain unchanged.

When a provider sets parallelToolCalls:false, the wire bit
parallel_tool_calls:false is only sent for the NVIDIA NIM baseUrl; every
other opted-out openai-chat provider silently OMITS the field. That is the
right default for strict OpenAI-compatible hosts that reject unknown knobs,
but self-hosted gateways (Kimi/GLM-family, vLLM, etc.) that DO honor the
field keep emitting concurrent tool calls in one streamed turn because they
never receive it.

Add an opt-in provider flag pinParallelToolCallsFalse that pins the wire bit
for such gateways without hardcoding their URL. Default behavior is
unchanged: the field is still omitted for every existing opted-out provider
(the NVIDIA hardcode and the omit-by-default path are both preserved), and
the flag has no effect unless parallelToolCalls === false.

Fixes lidge-jun#1650
@github-actions

Copy link
Copy Markdown
Contributor

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 14, 2026
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 55b03e43-5e5a-4a04-8923-08df8a6e15e3

📥 Commits

Reviewing files that changed from the base of the PR and between a1e5192 and d31627f.

📒 Files selected for processing (3)
  • src/adapters/openai-chat.ts
  • src/types.ts
  • tests/parallel-tool-calls-optin.test.ts

📝 Walkthrough

Walkthrough

The change adds pinParallelToolCallsFalse to provider configuration. For opted-out openai-chat providers, request construction now sends parallel_tool_calls: false. Tests cover default emission, request-level overrides, and omitted provider configuration.

Changes

Parallel tool-call pinning

Layer / File(s) Summary
Provider option, request behavior, and validation
src/types.ts, src/adapters/openai-chat.ts, tests/parallel-tool-calls-optin.test.ts
OcxProviderConfig now supports pinParallelToolCallsFalse. When parallelToolCalls is false, openai-chat sends parallel_tool_calls: false for NVIDIA NIM or providers with this option enabled. Tests verify forced emission, precedence over request-level true, and omission without the provider opt-out.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d3162

This localized change enables opted-in providers to send parallel_tool_calls:false while preserving existing defaults; no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: lidge-jun, olddonkey, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement issue #1650 through an explicit provider opt-in, preserve NVIDIA behavior, and retain omission for providers without the flag.
Out of Scope Changes check ✅ Passed The provider type, request construction, and tests are directly related to issue #1650 and the stated pull request objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: allowing opted-out providers to pin parallel_tool_calls:false.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed; the review readiness checklist is complete.

Review readiness checklist

  • ✅ All CI tests are green on my local testing.
  • ✅ I pushed my PR to the latest dev commit.
  • ✅ I resolved all correct Codex and CodeRabbit findings.
  • ✅ My PR is ready for review.

4/4 boxes ticked.

This pull request has been marked Ready for Review.
The review-ready label marks this PR as ready; review automation runs independently.
Maintainers notified: @lidge-jun @Ingwannu @Wibias

@github-actions
github-actions Bot marked this pull request as draft August 14, 2026 03:41
@github-actions
github-actions Bot marked this pull request as ready for review August 14, 2026 04:11

Wibias commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Thanks for this. The provider-level opt-in is useful because it fixes a real compatibility gap without changing the safe default for every OpenAI-compatible backend. Gateways that need parallel_tool_calls: false can now receive it explicitly, while stricter providers that may reject the field remain untouched. That gives us the compatibility knob without introducing a broad regression risk. 🙏

@Wibias
Wibias merged commit e480ce7 into lidge-jun:dev Aug 14, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants