Skip to content

Preserve supported Responses behavior in Chat translation - #7894

Merged
diegosouzapw merged 8 commits into
cheaper-inference:release/v3.8.49from
JxnLexn:dev/fix/responses-chat-translation
Jul 20, 2026
Merged

diegosouzapw merged 8 commits into
cheaper-inference:release/v3.8.49from
JxnLexn:dev/fix/responses-chat-translation

Conversation

@JxnLexn

@JxnLexn JxnLexn commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make Responses-to-Chat downgrades provider-neutral and loss-aware, preserving supported tools and output formats while rejecting unsupported input explicitly.

Validation

  • npm run lint
  • npm run test:unit
  • npm run test:coverage
  • Coverage is still >= 60% for statements, lines, functions, and branches
  • SonarQube PR analysis is green or any remaining issues are explicitly documented below

Tests Added Or Updated

  • Added Responses-to-Chat tests for additional tools, tool merging, structured output, allowed tools, unsupported input items, refusal history, and Responses-only fields.

Coverage Notes

  • Translation tests cover tool collection and conversion, structured output mapping, allowed-tool filtering, unsupported feature rejection, refusal normalization, and field stripping.

Reviewer Notes

  • Review tool precedence and allowed_tools validation, particularly for namespaced tools and strict Chat-compatible endpoints.
  • Unsupported Responses input items now fail explicitly rather than disappearing during translation.

@JxnLexn
JxnLexn requested a review from diegosouzapw as a code owner July 20, 2026 17:10

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

Copy link
Copy Markdown

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

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

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

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

Copy link
Copy Markdown

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: 5f7a47ffe4

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

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

Copy link
Copy Markdown

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: 0135d01b2c

ℹ️ 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 +89 to +92
const identity = toolIdentity(tool);
if (identity && seen.has(identity)) continue;
if (identity) seen.add(identity);
merged.push(tool);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Deduplicate flattened function names

When an additional_tools namespace contains a subtool whose name also appears as a top-level function (or in a differently named namespace), these raw identities are distinct and both entries survive collection. The subsequent Chat conversion flattens namespaces, producing duplicate function.name values; unlike Gemini's sanitizer, direct OpenAI-compatible and Claude paths forward duplicate tools, which strict upstreams reject. Deduplicate after namespace flattening (while retaining top-level precedence) rather than only by the namespace container identity.

Useful? React with 👍 / 👎.

@diegosouzapw
diegosouzapw merged commit 4f52e36 into cheaper-inference:release/v3.8.49 Jul 20, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Merged — thanks @JxnLexn! Making the Responses→Chat downgrade loss-aware (merging both tool-declaration sources) is a real correctness win for that translation path. Validated in the local merge-train (combined tree, full unit suite + vitest green) on tomni-proxmox-113 @ 998752fbca then squash-merged.

@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…ference#7894)

* fix(responses): preserve additional_tools when downgrading to Chat Completions

* fix: preserve Responses structured output in Chat translation

* fix: translate Responses allowed tools to Chat

* fix: reject unsupported Responses input items

* fix: normalize Responses refusal history for Chat

* fix: strip Responses-only fields from Chat requests

* fix: preserve namespace tools with colliding function names

* fix: merge same-named namespaces during Chat translation
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…ference#7894)

* fix(responses): preserve additional_tools when downgrading to Chat Completions

* fix: preserve Responses structured output in Chat translation

* fix: translate Responses allowed tools to Chat

* fix: reject unsupported Responses input items

* fix: normalize Responses refusal history for Chat

* fix: strip Responses-only fields from Chat requests

* fix: preserve namespace tools with colliding function names

* fix: merge same-named namespaces during Chat translation
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.

2 participants