Skip to content

fix(types): allow find_in_page actions without url - #3792

Open
sylvesterkaczmarek wants to merge 8 commits into
openai:mainfrom
sylvesterkaczmarek:fix/find-in-page-optional-url
Open

fix(types): allow find_in_page actions without url#3792
sylvesterkaczmarek wants to merge 8 commits into
openai:mainfrom
sylvesterkaczmarek:fix/find-in-page-optional-url

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Fixes #3788.

The live Responses API can omit url from completed web_search_call actions of type find_in_page, but the generated stable and beta find_in_page action types still require it. Re-validating an API-produced item therefore fails even though the payload is valid.

This aligns both stable and beta action models and parameter types with the live response shape by making url optional, matching the existing optional treatment for open_page.url.

Tests

Adds regression coverage that validates completed stable and beta find_in_page actions with no url and verifies the parameter TypedDicts no longer require the key.

@sylvesterkaczmarek
sylvesterkaczmarek requested a review from a team as a code owner September 3, 2026 21:04
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 3, 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-09-03T21:10:19.261751Z e600208 PR opened
🔒 Security Review Completed 2026-09-03T21:08:10.159069Z e600208 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.

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

ℹ️ 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 tests/test_web_search_action_types.py Outdated


def test_find_in_page_action_allows_missing_url() -> None:
item = ResponseFunctionWebSearch.model_validate(_find_payload())

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 Parse models through the Pydantic compatibility helper

When ./scripts/test reaches its unconditional Pydantic 1.10.26 pass, this call raises AttributeError because Pydantic v1 models do not provide model_validate; the beta test repeats the same call on line 25. Use the repository's openai._compat.model_parse helper (or another v1-compatible parsing path) so the new tests pass in both supported Pydantic environments.

Useful? React with 👍 / 👎.


assert item.action.type == "find_in_page"
assert item.action.url is None
assert "url" not in ActionFindParam.__required_keys__

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Exercise optional keys without __required_keys__

This assertion does not verify the intended TypedDict change: both parameter modules use postponed annotations, so typing_extensions records Required[str] as a forward reference and __required_keys__ omits url even with the old broken url: Required[str] declaration. The beta assertion has the same false-positive behavior; add a statically checked assignment that omits url, or resolve and inspect the annotation, so reverting the parameter fix would actually fail validation.

Useful? React with 👍 / 👎.


url: Required[str]
"""The URL of the page searched for the pattern."""
url: Optional[str]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep present URLs non-nullable

The reported API discrepancy is that url may be omitted, not that a present url may be null; the checked-in contract still defines it as a non-null string URI in api_reference/openapi.transformed.yml:60837-60841. Because this TypedDict already has total=False, declaring url: str makes the key optional while continuing to reject None; using Optional[str] instead exposes null as a valid request value to type-checked callers even though the API may reject it. The beta parameter type has the same problem.

Useful? React with 👍 / 👎.

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.

ActionFind.url is required but live find_in_page web_search_call items omit url

1 participant