Skip to content

fix(openai): exclude OPENAI_BASE_URL from hosted tool search - #4793

Merged
aheritier merged 1 commit into
docker:mainfrom
oyobbeb:fix/openai-tool-search-endpoint
Nov 4, 2026
Merged

aheritier merged 1 commit into
docker:mainfrom
oyobbeb:fix/openai-tool-search-endpoint

Conversation

@oyobbeb

@oyobbeb oyobbeb commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4773.

#4773 made three endpoint checks see OPENAI_BASE_URL, but NativeToolSearchEnabled still reads only base_url. With OPENAI_BASE_URL pointing at another server and native_tool_search: true, hosted tool search stays on while response replay is now off, and tool search needs that replay to keep its loaded tools across turns.

This adds Config.Endpoint(), which returns base_url or else the endpoint resolved at construction, and has NativeToolSearchEnabled and the three checks from #4773 use it, so they can't drift apart again.

This reverses a choice from #4355: the resolved endpoint was deliberately not consulted "so tests can point the SDK at a local server", and TestConfigNativeToolSearchEnabled_IgnoresResolvedBaseURL pinned that. I flipped and renamed that test. The tests here that talk to a local server don't go through the resolved endpoint: unit tests inject the SDK client through clientFn, the runtime tool search test reroutes the transport, and e2e uses --models-gateway. They keep the default endpoint and still pass.

TestResponseStateOpenAIBaseURLEnv now also opts into native_tool_search and checks that it ends up off. It and the flipped test fail on main. go test ./..., golangci-lint and go run ./lint . pass.

NativeToolSearchEnabled only read base_url, so with OPENAI_BASE_URL
pointing at another server hosted tool search stayed on while docker#4773
turned response replay off, which tool search needs to keep its loaded
tools.

Add Config.Endpoint() and use it in NativeToolSearchEnabled and the
three checks from docker#4773.

Signed-off-by: Yeongbin Jeong <oyobbeb@gmail.com>
@oyobbeb
oyobbeb requested a review from a team as a code owner November 2, 2026 09:04
@aheritier aheritier added area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/fix PR fixes a bug (maps to fix:). Use on PRs only. labels Nov 2, 2026

@aheritier aheritier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed all five changed files against #4773, #4594, and the hosted-search contract introduced in #4355. No substantive defects found. Hosted tool search now respects the resolved OPENAI_BASE_URL endpoint, while explicit base_url precedence and default-endpoint/gateway behavior are preserved. Regression tests cover resolved custom/default endpoints and client construction with the environment override.

CI operational status: PASS at this head. The required gate, Linux/Windows tests, lint, cross-compilation, licenses, image build, and CodeQL passed; test-race was skipped. Linux CI logs confirm the base, OpenAI, and runtime packages passed. No local tests were run. The PR is non-draft and conflict-free; GitHub still reports mergeable_state=blocked.

Issue context: Reviewed the linked PRs and issue, including relevant reasoning-replay background and accessible comments/reviews. No Jira references or material acceptance-context gaps found.

Prior threads: None; the PR has no issue comments, reviews, inline comments, or review threads.

@aheritier
aheritier added this pull request to the merge queue Nov 4, 2026
Merged via the queue into docker:main with commit 30c9e9f Nov 4, 2026
16 checks passed
trungutt pushed a commit to trungutt/docker-agent that referenced this pull request Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/providers/openai For features/issues/fixes related to the usage of OpenAI models kind/fix PR fixes a bug (maps to fix:). Use on PRs only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants