SIGN IN SIGN UP

fix: preserve single files for fallback extraction paths (#3875)

- [x] I understand that this repository is auto-generated and my pull
request may not be merged.

## Changes being requested

Fixes #3874.

When the Skills `files` parameter is a single file, the array extraction
path consumes it before the fallback single-file path can run. This
produces an empty JSON request instead of uploading the file.

Keep non-list values available when a path still expects an array.
Direct file extraction and list uploads retain their existing behavior.
Add bytes/tuple extraction regressions and synchronous/asynchronous
public-client tests that construct a real in-memory zip and inspect its
multipart field, filename and content through MockTransport.

## Additional context & links

- [Skills create accepts a single zip or multiple
files](https://developers.openai.com/api/reference/python/resources/skills/methods/create).
- Before the fix: 4 failed, 33 passed. After: 37 passed with
`PYTHONPATH=src .venv/bin/python -m pytest -o addopts=''
tests/test_extract_files.py tests/test_files.py -q`. Tests run serially
and make no live API requests.
- Ruff lint and format checks pass on all three changed files; `git diff
--check` passes.
- Python 3.13.15, httpx2 2.12.0, Pydantic 2.13.5 on macOS ARM64. The
full SDK suite, Pyright and mypy were not run locally.
- The custom-code policy, budget and generated ownership metadata are
unchanged. Budget validation remains with the trusted upstream CI; SDK
CODEOWNER review is required for this file-handling change.

Co-authored-by: Marcus Wood <marcuswood@openai.com>
H
Haokai Ding committed
bfd3680c8d3b715bb3175b82cd0fa1c1fb53162f
Parent: 4d12746
Committed by GitHub <noreply@github.com> on 9/23/2026, 9:28:59 PM