Skip to content

fix(opengateway): lower routed custom tools on the Responses wire - #6879

Merged
lidge-jun merged 1 commit into
devfrom
codex/6877-opengateway-custom-tools
Oct 10, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/6877-opengateway-custom-tools

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

On the Responses wire, OpenGateway answers 400 invalid_request_error once a Codex turn replays native custom_tool_call / custom_tool_call_output history (code-mode exec). The first turn succeeds and the second fails. The same request succeeds after the custom tool is lowered to a function tool, which is what supportsResponsesCustomTools: false does; the xAI preset already declares it for the same reason.

This adds supportsResponsesCustomTools: false to the OpenGateway registry entry. Saved provider rows without their own value inherit it through the existing enrichProviderFromRegistry / router backfill, and an explicit user true still wins. The OpenGateway section of the providers guide now says custom tools are lowered on that wire.

Closes #6877

Verification

  • bun test tests/providers/opengateway-provider.test.ts: 10 pass. Two new cases cover the registry flag, inheritance versus an explicit override, and a replayed exec history whose tool is no longer declared, which now serializes as function_call / function_call_output.
  • Negative control: with the registry change reverted, both new cases fail (Received: undefined, and the history keeps custom_tool_call items).
  • bun x tsc --noEmit: exit 0.
  • Full suite not run locally (lane runs focused checks; coverage left to hosted CI). No live OpenGateway request was made, so upstream acceptance relies on the reporter's A/B.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Bug Fixes

    • OpenGateway now converts replayed custom-tool calls and results to function-tool format on the Responses API, preserving call IDs and supporting tools no longer declared in the current request.
    • OpenGateway configurations now indicate that native Responses custom-tool history is unsupported, while preserving explicit configuration choices.
  • Documentation

    • Updated the OpenGateway provider guide to explain how custom tools are handled on the Responses API.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 10, 2026 09:04
@lidge-jun lidge-jun added the bug Something isn't working label Oct 10, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-10T09:07:18.639162Z be40e5b PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 3fc9b048-e634-435f-b96a-c8f779519c60

📥 Commits

Reviewing files that changed from the base of the PR and between 6524ce8 and be40e5b.


📒 Files selected for processing (3)
  • docs-site/src/content/docs/guides/providers.md
  • src/providers/registry/entries-extended.ts
  • tests/providers/opengateway-provider.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The OpenGateway preset now declares native Responses custom tools unsupported. Tests cover registry defaults, explicit overrides, and conversion of replayed custom-tool history to function-call items. The provider guide documents this conversion.

Changes

OpenGateway Responses compatibility

Layer / File(s) Summary
Declare and verify custom-tool compatibility
src/providers/registry/entries-extended.ts, tests/providers/opengateway-provider.test.ts, docs-site/src/content/docs/guides/providers.md
The OpenGateway registry entry disables native Responses custom tools. Tests verify default enrichment, preservation of an explicit true, and conversion of replayed exec history into function-call items with the original call ID. The provider guide documents the conversion.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to be40e

The OpenGateway preset, tests, and guide align on converting custom-tool history to function tools. No actionable issue remains before normal merge checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: lowering routed custom tools on the OpenGateway Responses wire.
Linked Issues check Passed Issue #6877 requires the OpenGateway preset to set supportsResponsesCustomTools: false so Responses-native custom-tool history is lowered to function calls. `src/providers/registry/entries-extended.…
Out of Scope Changes check Passed The reviewed changes are limited to the OpenGateway registry declaration, focused OpenGateway compatibility tests, and the matching provider-guide documentation. The changes do not add `unsupportedHos…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@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: be40e5b008

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

// #6877: on the Responses wire OpenGateway answers 400 once history replays native
// custom_tool_call/custom_tool_call_output items (Codex code-mode exec), and accepts the
// same request after the custom tool is lowered to a function. Same contract as xAI.
supportsResponsesCustomTools: false,

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 Update the owned structure docs for this registry behavior

This changes provider-registry behavior, but the commit updates only the public guide; the maintainer source of truth—including the existing OpenGateway section in structure/providers-and-adapters.md—still omits the new provider-wide Responses custom-tool denial and lowering invariant. Update the structure documents mapped to src/providers/ so future transport work does not rely on an incomplete architecture contract.

AGENTS.md reference: src/AGENTS.md:L10-L11

Useful? React with 👍 / 👎.

@lidge-jun
lidge-jun merged commit 696dadc into dev Oct 10, 2026
40 of 41 checks passed
@lidge-jun
lidge-jun deleted the codex/6877-opengateway-custom-tools branch October 10, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant