Skip to content

Preserve required argument order in errors - #3645

Open
tandede wants to merge 2 commits into
openai:mainfrom
tandede:fix-required-args-order
Open

Preserve required argument order in errors#3645
tandede wants to merge 2 commits into
openai:mainfrom
tandede:fix-required-args-order

Conversation

@tandede

@tandede tandede commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • preserve each required_args variant's declaration order when listing missing arguments
  • add an exact regression assertion for multi-argument error messages

Why

The single-variant error path currently computes missing arguments with a set difference. Set iteration depends on Python's randomized hash seed, so an identical invalid SDK call can list parameters in a different order across processes. For example, the same declaration produced both 'model', 'messages' or 'stream' and 'messages', 'stream' or 'model' under different PYTHONHASHSEED values.

Filtering the declared variant in place makes the message deterministic and keeps it aligned with the method signature.

Validation

  • verified identical output across 8 different PYTHONHASHSEED values
  • python -m pytest -q -n 0 tests/test_required_args.py tests/test_utils tests/test_models.py (197 passed)
  • ruff check .
  • ruff format --check .
  • mypy src/openai/_utils/_utils.py

@tandede
tandede marked this pull request as ready for review August 19, 2026 11:28
@tandede
tandede requested a review from a team as a code owner August 19, 2026 11:28
@tandede
tandede force-pushed the fix-required-args-order branch from b9e4a11 to 5eba6f8 Compare August 21, 2026 11:20
@tandede
tandede force-pushed the fix-required-args-order branch from 5eba6f8 to 24463f5 Compare August 21, 2026 11:23
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

requires-python = ">= 3.10"

P1 Badge Separate the Python floor increase from unrelated upgrades

Changing requires-python from 3.9 to 3.10 makes this release uninstallable for Python 3.9 users, but the same commit also changes exported SDK behavior and upgrades runtime dependencies such as Pydantic, jiter, aiohttp, and urllib3. Split the floor increase into its own release change so its compatibility validation and release communication aren't coupled to the unrelated SDK and dependency changes, as the repository policy explicitly requires.

AGENTS.md reference: AGENTS.md:L45-L48

ℹ️ 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".

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