Skip to content

fix(translator): strip Responses-only truncation field before Chat Completions forwarding - #6109

Merged
diegosouzapw merged 3 commits into
release/v3.8.44from
fix/port-issue-2311-strip-truncation
Jul 4, 2026
Merged

diegosouzapw merged 3 commits into
release/v3.8.44from
fix/port-issue-2311-strip-truncation

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Summary

  • The Responses → Chat Completions request converter (open-sse/translator/request/openai-responses.ts) now strips the Responses-API-only truncation field before forwarding.
  • Fields client_metadata, background, and safety_identifier were already stripped; truncation ("auto" / "disabled") was the remaining gap.

Root cause

openaiResponsesToOpenAIRequest builds result = { ...body }, then deletes known Responses-only fields. truncation was never deleted, so it survived into the outgoing Chat Completions payload. Strict non-OpenAI upstreams (e.g. NVIDIA NIM) reject unknown params:

{ "message": "Validation: Unsupported parameter(s): `truncation`", "type": "Bad Request", "code": 400 }

This broke Codex-style clients (which send truncation) routed through a combo to such providers.

Fix

Add delete result.truncation; alongside the existing Responses-only field cleanup, with a comment documenting why.

Attribution

Thanks to @TuanNguyen0708 for the original report.

Test plan

  • New regression test tests/unit/responses-strip-truncation-2311.test.ts (red before the fix, green after): asserts truncation — and the full Responses-only set — is stripped.
  • node --test on the translator suites: 43/43 green (no regression).
  • npm run lint (touched files): 0 errors.
  • npm run typecheck:core: clean.
  • npm run check:cycles: no cycles.

…ons (port from 9router#2311)

The Responses→Chat-Completions converter spreads the request body and deletes
known Responses-API-only fields (client_metadata, background, safety_identifier),
but `truncation` ("auto"/"disabled") slipped through. Strict non-OpenAI upstreams
(e.g. NVIDIA NIM) reject it with HTTP 400 "Unsupported parameter(s): truncation",
breaking Codex-style clients routed to those providers.

Reported-by: TuanNguyen0708 (decolua/9router#2311)
Co-authored-by: Rex <177378174+anki1kr@users.noreply.github.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit d927f2d into release/v3.8.44 Jul 4, 2026
1 of 3 checks passed
@diegosouzapw
diegosouzapw deleted the fix/port-issue-2311-strip-truncation branch July 4, 2026 07:38
@diegosouzapw diegosouzapw mentioned this pull request Jul 4, 2026
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…mpletions forwarding (diegosouzapw#6109)

Strip Responses-only truncation field before Chat Completions forwarding (diegosouzapw#2311). Integrated into release/v3.8.44.
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.

1 participant