Skip to content

Decode hosted web search sources for clients#31379

Open
alexi-openai wants to merge 1 commit into
codex/web-search-results-clientfrom
codex/web-search-sources
Open

Decode hosted web search sources for clients#31379
alexi-openai wants to merge 1 commit into
codex/web-search-results-clientfrom
codex/web-search-sources

Conversation

@alexi-openai

@alexi-openai alexi-openai commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • deserialize bounded hosted web search source URLs as transient response metadata
  • convert them into client-facing WebSearchItem.results for app rendering and persistence
  • remove the sources from the client-facing action after conversion

Stacked on #31515. Standalone /alpha/search parsing is split into #31516.

Model-context boundary

The hosted sources field is deserialize-only: Serde skips it during serialization, and it is excluded from Rust/TypeScript schemas. A two-turn regression test verifies that the app receives the URL while the next Responses request contains no action.sources field.

This PR intentionally does not change Responses request construction. Requesting the hosted source sidecar can be reviewed as a separate one-line follow-up.

Validation

  • just test -p codex-protocol
  • just test -p codex-app-server-protocol
  • env -u CODEX_SANDBOX_NETWORK_DISABLED just test -p codex-core web_search_item_is_emitted
  • just test -p codex-core parses_web_search_call
  • just test -p codex-web-search-extension
  • just test -p codex-app-server-protocol -p codex-exec -p codex-web-search-extension web_search
  • just fix (scoped to affected packages)
  • just fmt

@alexi-openai alexi-openai force-pushed the codex/web-search-sources branch 2 times, most recently from b34d3a6 to 99afc38 Compare July 7, 2026 08:09
@alexi-openai alexi-openai marked this pull request as ready for review July 7, 2026 08:29
@alexi-openai alexi-openai requested a review from a team as a code owner July 7, 2026 08:29

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

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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 99afc38d5c

ℹ️ 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 thread codex-rs/core/src/client.rs Outdated
Vec::new()
};
if is_openai {
include.push("web_search_call.action.sources".to_string());

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.

P0 Badge Cap web search sources before putting them in context

When hosted web search is available and the Responses API returns a large action.sources array, this new include asks for the full list and it is then retained as part of the ResponseItem history that is sent on later requests; unlike the standalone web-search extraction, there is no hard cap or truncation on these URLs before they enter model context. A search with many or very long source URLs can therefore add a >1k-token item and cause unbounded context/cache growth, so the sources should be bounded before being persisted or replayed.

AGENTS.md reference: AGENTS.md:L91-L100

Useful? React with 👍 / 👎.

Comment thread codex-rs/core/src/client.rs Outdated
Comment on lines +879 to +880
if is_openai {
include.push("web_search_call.action.sources".to_string());

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.

P2 Badge Include sources for Azure Responses providers

When the configured provider is Azure Responses, provider.info().is_openai() is false even though the request later uses the Azure Responses path (store: provider.is_azure_responses_endpoint()), so web-search turns on Azure never send include: ["web_search_call.action.sources"] and the new app-server sources field remains null. Azure's Responses web-search docs also require this include to return action.sources, so Azure users with web search enabled will not get the source URLs this change is meant to expose (Microsoft Learn).

Useful? React with 👍 / 👎.

@alexi-openai alexi-openai force-pushed the codex/web-search-sources branch 2 times, most recently from 45cd640 to 654750b Compare July 7, 2026 19:06
@alexi-openai alexi-openai force-pushed the codex/web-search-sources branch from 654750b to f76eb1d Compare July 8, 2026 02:54
@alexi-openai alexi-openai changed the title [app-server] Expose web search source URLs Decode hosted web search sources for clients Jul 8, 2026
@alexi-openai alexi-openai changed the base branch from main to codex/web-search-results-client July 8, 2026 02:54
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