Skip to content

[openai] Route inference-provider-native web search to Responses native web_search tool#26212

Merged
noanflaherty merged 1 commit into
noanflaherty/managed-openai-native-web-searchfrom
run-plan/managed-openai-web/pr-2
Apr 17, 2026
Merged

[openai] Route inference-provider-native web search to Responses native web_search tool#26212
noanflaherty merged 1 commit into
noanflaherty/managed-openai-native-web-searchfrom
run-plan/managed-openai-web/pr-2

Conversation

@noanflaherty
Copy link
Copy Markdown
Contributor

@noanflaherty noanflaherty commented Apr 17, 2026

Summary

  • Thread useNativeWebSearch into OpenAIResponsesProvider options
  • Map web_search tool to OpenAI native hosted web search descriptor when native mode enabled
  • Maintain backward compatibility when native mode is off
  • Add provider and cross-provider tests for native web search behavior

Part of plan: managed-openai-native-web-search.md (PR 2 of 4)


Open with Devin

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚩 No response-side handling for native web search output items

When web_search_preview is used as a native hosted tool, OpenAI's Responses API may return output items of type web_search_call in the stream (via response.output_item.added). The current stream handler at responses-provider.ts:209-222 only processes items where item?.type === 'function_call', so any web_search_call items would be silently ignored. This is likely fine because the native web search results are incorporated into the text output deltas automatically by OpenAI's server, so the final text content is still captured. However, if there's a need to surface web search metadata (URLs, sources) to the caller — similar to how Anthropic's provider emits server_tool_start/server_tool_complete events — this would need additional handling in a follow-up.

(Refers to lines 209-222)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@noanflaherty noanflaherty merged commit 6cd9b54 into noanflaherty/managed-openai-native-web-search Apr 17, 2026
12 checks passed
@noanflaherty noanflaherty deleted the run-plan/managed-openai-web/pr-2 branch April 17, 2026 21:04
noanflaherty added a commit that referenced this pull request Apr 17, 2026
* [managed] Enable OpenAI managed-proxy fallback routing in provider bootstrap (#26211)

* [openai] Route inference-provider-native web search to Responses native web_search tool (#26212)

* [macOS] Allow managed inference provider selection beyond Anthropic (#26218)

* [macOS] Allow managed inference provider selection beyond Anthropic

* fix: capture draftProvider before async Task to prevent race condition

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* [macOS] Allow provider-native web search when managed inference provider supports it (#26230)

* [macOS] Allow provider-native web search when managed inference provider supports it

* fix: gate mode-specific web search invalidation on modeChanging to prevent false-positive alerts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: generalize alert message to cover both mode and provider changes

* fix: scope provider-native invalidation to your-own web search mode

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: emit server_tool_start/complete events for OpenAI native web search (#26240)

* fix: render web_search_call output items in LLM context diagnostics (#26243)

* fix: add server_tool_use content blocks and tests for OpenAI native web search (#26246)

* fix: diagnostics polish — web_search_call tests, tool count fix, loop consistency (#26250)

* fix: emit paired web_search_tool_result blocks to prevent repairHistory corruption

The OpenAI Responses provider emitted server_tool_use content blocks for
web_search_call items but did not emit matching web_search_tool_result blocks.
repairHistory() treats any unpaired server_tool_use as an interrupted search
and injects a synthetic web_search_tool_result_error, which corrupts
conversation history by making successful searches appear as failures.

After each server_tool_use block, also emit a paired web_search_tool_result
with empty content (since OpenAI weaves search results into the text output).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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