Skip to content

fix(translator): strip neutral tool_choice when tools absent in Responses-to-Chat (#12141) - #12166

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
HouMinXi:fix/12141-responses-tool-choice
Sep 1, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.51from
HouMinXi:fix/12141-responses-tool-choice

Conversation

@HouMinXi

Copy link
Copy Markdown
Contributor

Summary

Closes #12141.

When clients invoke the /v1/responses endpoint with neutral tool_choice ("auto" or "none") without providing tools (or passing tools: []), translating to Chat Completions (openaiResponsesToOpenAIRequest) previously preserved tool_choice verbatim. Strict Chat Completions backends (such as vLLM, Ollama, and strict OpenAI-compatible engines) reject requests containing tool_choice without tools with HTTP 400: When using tool_choice, tools must be set.

Changes

  • open-sse/translator/request/openai-responses.ts: In openaiResponsesToOpenAIRequest, after tool extraction and filtering, when finalChatTools.length === 0 and result.tool_choice is "auto" or "none", delete result.tool_choice. Contradictory choices ("required" or explicit function objects) remain preserved so upstream contracts remain transparent.
  • tests/unit/responses-to-chat-no-tools-tool-choice-12141.test.ts: Dedicated test suite verifying empty tools with auto, none, valid tools preservation, and contradictory choice retention.
  • tests/unit/responses-translation-fixes.test.ts: Updated existing test case to verify both with-tools preservation and without-tools stripping.

Verification

  • npm run typecheck:core: 0 errors.
  • npm run check:cycles: PASS (no cycles).
  • node --test tests/unit/responses-to-chat-no-tools-tool-choice-12141.test.ts tests/unit/responses-translation-fixes.test.ts: 48/48 PASS.
  • Regression suite: all translator tests (76/76) PASS.

…nses-to-Chat (diegosouzapw#12141)

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi requested a review from diegosouzapw as a code owner August 31, 2026 01:21
diegosouzapw added a commit that referenced this pull request Sep 1, 2026
…12248)

Merging --admin with red discrimination (merge-gates §4). The only failing check is Fast Quality Gates → `mutation-test-coverage`, which cannot be caused by this PR: the diff touches exactly one file, `CLAUDE.md` (13 deleted lines, zero .ts). The same gate is red on #12166, #12167 and #12169 — three unrelated PRs — confirming inherited base drift rather than a PR-introduced defect.
@diegosouzapw

Copy link
Copy Markdown
Owner

Validated in local merge-train on 192.168.0.113 — train of #12258 #12262 #12166 #12281 #11259 #11950 merged clean onto origin/release/v3.8.51 (f5e7095):

  • Run 1 (/opt/actions-runner-omniroute-5, train tip 85cd9119): typecheck:core, file-size, complexity ×2, changelog-integrity — all green; the test:unit step was killed by a CI job landing on that runner mid-train (workspace clobbered — infra, documented risk).
  • Run 2 (/srv/omniroute-train/.claude/worktrees/mt-green1, same 6 PRs re-boarded, fresh npm ci): unit 35768/35805 pass (/tmp/mt-unit2.log), vitest 464/465 (/tmp/mt-vitest2.log).
  • Every failure is a latency/timing assert (bounded-time, event-loop lag, cooldown windows) on a box that was never idle (3 active CI runner workers throughout). Discriminated per merge-gates §3: the 3 persistent titles reproduce identically on the pure base tip on the same box (/tmp/mt-base-isolated.log, BASE_ISOLATED_EXIT=1 — same tests, same asserts), 5 more titles reproduce on the pure base on the devbox, and the single vitest failure (provider-family-combos) also fails on main's nightly without any of these PRs. Inherited/infra — not introduced by this train.

@diegosouzapw
diegosouzapw merged commit 9629d78 into diegosouzapw:release/v3.8.51 Sep 1, 2026
15 of 16 checks passed
@HouMinXi
HouMinXi deleted the fix/12141-responses-tool-choice branch September 16, 2026 13:48
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…w#11770)" (diegosouzapw#12248)

Merging --admin with red discrimination (merge-gates §4). The only failing check is Fast Quality Gates → `mutation-test-coverage`, which cannot be caused by this PR: the diff touches exactly one file, `CLAUDE.md` (13 deleted lines, zero .ts). The same gate is red on diegosouzapw#12166, diegosouzapw#12167 and diegosouzapw#12169 — three unrelated PRs — confirming inherited base drift rather than a PR-introduced defect.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
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.

[BUG] Responses-to-Chat forwards tool_choice="auto" without tools, causing upstream 400

2 participants