Skip to content

fix(relaykit): preserve non-strict Chat function defaults in Responses - #8490

Open
7dul2 wants to merge 1 commit into
QuantumNous:mainfrom
ai-lu-k:codex/preserve-chat-function-strict-default
Open

7dul2 wants to merge 1 commit into
QuantumNous:mainfrom
ai-lu-k:codex/preserve-chat-function-strict-default

Conversation

@7dul2

@7dul2 7dul2 commented Nov 28, 2026 •

Copy link
Copy Markdown

Agent: Codex unknown · unknown · macOS arm64 · 2026-11-28 UTC

Related: none

Request summary

Check whether new-api already preserves the Chat Completions default for function tools and submit the fix upstream. This patch was AI-assisted with Codex.

Summary

Chat Completions defaults to non-strict function calls. Responses can require optional parameters when the flag is absent. Preserve the Chat default during conversion.

  POST /v1/chat/completions with an omitted function.strict
- POST /v1/responses with an omitted tool.strict
+ POST /v1/responses with tool.strict=false

Explicit true and false values keep their original values.

Evidence

Local checkout of v1.0.0-rc.52 (04dfcbb). An Advanced Custom adaptor sent gpt-test requests to an HTTP Responses fixture with pass-through disabled. The fixture simulates strict normalization. The reproduction uses no database.

  • Before: A lookup function requires query and makes note optional. Direct POST /v1/responses with strict:false returned HTTP 200 and arguments {"query":"cube"}. For the equivalent Chat request, the fixture logged strict=omitted and returned HTTP 200 with {"query":"cube","note":""}.
  • After: The same Chat request sent strict:false and matched the direct HTTP 200 arguments. In relaykit, GOWORK=off go test ./relayconvert -run '^TestChatToResponsesPreservesFunctionStrictness$' -count=1 failed on the missing field before the patch and passed after it. The independent go build ./... and go test ./... also passed.

Merge Danger

Door: two-way

Blast Radius: relay

Summary by CodeRabbit

  • Bug Fixes
    • Function tools converted from OpenAI Chat Completions to OpenAI Responses now default to strict: false when strictness isn’t specified. Explicit strict: true and strict: false values are preserved. This makes the resulting function-tool settings consistent while retaining any strictness choice already provided.

Chat Completions treats an omitted strict flag as false. Responses may normalize the same function schema and require its optional arguments. Emit false for converted Chat functions with an omitted flag and forward explicit flags unchanged.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

OpenAI Responses encoding now sets strict to false for OpenAI Chat function tools when strictness is unspecified. Tests cover omitted and explicit strictness values, and the golden request output includes the new default.

Changes

Function tool strictness

Layer / File(s) Summary
Encoding and conversion validation
relaykit/relayconvert/internal/toolconv/encode.go, relaykit/relayconvert/request_registry_test.go, relaykit/relayconvert/testdata/golden/request/openai_to_openai_responses.golden.json
Responses encoding defaults unspecified strictness to false for OpenAI Chat function tools. The test covers omitted, explicit false, and explicit true values. The golden request includes "strict": false.

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

Change: Bug fix

Suggested reviewers: calcium-ion

Merge Risk: Minimal · up to c1062

This change makes Chat-to-Responses conversion keep the Chat default of non-strict function calls. It is a small, localized change with matching tests, and no actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the actual change: Chat function tools that omit strictness now default to non-strict when converted to Responses. The raw summary confirms the encode.go change, the new test, and the …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual change: Chat function tools that omit strictness now default to non-strict when converted to Responses. The raw summary confirms the encode.go change, the new test, and the golden file update all serve this purpose. The title is specific, under 72 characters, and follows the conventional-commit style.

Finishing Touches

Generate unit tests (beta)

  • 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

A rabbit checks the tools at night
One missing flag now defaults right
True stays true, and false stays too
The golden file reflects the view
Then hops away beneath the moon

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b66a9f8f-c534-4776-9cdb-a85a5d9b2fdf
Commits

Reviewing files that changed from the base of the PR and between 04dfcbb and c106280.

Files selected for processing: 3

  • relaykit/relayconvert/internal/toolconv/encode.go
  • relaykit/relayconvert/request_registry_test.go
  • relaykit/relayconvert/testdata/golden/request/openai_to_openai_responses.golden.json

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

This branch has not been deployed

No deployments
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