Skip to content

[pull] main from openai:main - #142

Merged
pull[bot] merged 5 commits into
gitupdates:mainfrom
openai:main
Aug 21, 2026
Merged

[pull] main from openai:main#142
pull[bot] merged 5 commits into
gitupdates:mainfrom
openai:main

Conversation

@pull

@pull pull Bot commented Aug 21, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

apcha-oai and others added 5 commits August 21, 2026 09:29
## Summary

Refine documentation for the image 'background' parameter across the
Images resource and related type definitions. These changes only update
descriptions and wording; there are no changes to function signatures,
types, or runtime behavior.

## Changes

- Rewrite and clarify the 'background' parameter description for image
generation and editing to state it must be one of 'transparent',
'opaque', or 'auto' and that 'auto' lets the model choose the
background.
- Document that transparent backgrounds are available for supported GPT
Image models and explicitly mark gpt-image-2 and gpt-image-2-2026-04-21
support as preview-level, rather than stating transparent backgrounds
are not supported.
- Add/clarify guidance that when requesting a transparent background the
returned image format should support transparency (e.g., 'png' or
'webp').
- Apply these documentation updates consistently in runtime resource
docstrings and in typed models/typed dicts describing image parameters
and responses.
- No changes to public types, method signatures, parameter names,
accepted values, or return types; no customer-visible behavior or API
contract changes.

Co-authored-by: apcha-oai <228803254+apcha-oai@users.noreply.github.com>
## Summary

Set a generous 10,000-line ceiling for the Python SDK's remaining
customization of generated files. The current verified patch is 6,558
lines (+6,010 / −548), so normal development has headroom while
unusually large patches need an explicit decision.

This PR intentionally changes only `.castiron-ratchet.json`. Keeping the
policy separate means an SDK change cannot raise its own allowance. A
human approving review is required; the automated technical review is
not policy approval.

Companion tooling PR #3715 adds enforcement using the budget already on
`main`. Land this policy first. This seed alone does not enable a
required check, and it does not change SDK behavior or CODEOWNERS.
## Summary

A small SDK diff can hide a large patch against generated output. Add a
custom-code gate that counts custom additions and deletions together,
using the budget and checker already on `main`.

Extend the existing two custom-code workflows and reuse their trusted
report—no new workflows or compiler changes. Keep the report comment
available when the gate fails, preserve default CODEOWNERS, and require
a separate justified, human-reviewed PR for budget increases.

Budget-only #3714 is merged; this PR is rebased onto `main`. Enable
`Castiron / budget-only change` and `Castiron / custom-code budget` only
after the tooling is on `main` and the rollout checks in
`scripts/castiron/CUSTOM_CODE.md` pass, retaining the required merge
queue. `AGENTS.md` and `CONTRIBUTING.md` contain the agent rules and
contributor policy and link to those technical details. This PR does not
activate repository rules or enable auto-merge.
- [x] I understand that this repository is auto-generated and my pull
request may not be merged

## Changes being requested

Move the existing sync/async vector-store file and file-batch polling
bodies into SDK-owned `lib/_vector_stores.py`, sharing their identical
`openai-poll-after-ms` lookup, integer conversion, and one-second
fallback. The public `poll` methods remain thin delegates with the same
signatures, defaults, docstrings, and return types.

Request headers, response parsing, interval handling, terminal
conditions, return identity, and error/cancellation propagation are
preserved. Upload orchestration, create-and-poll methods, other
requests, and response wrappers are untouched. This adds no generic
polling framework, timeout behavior, schema/compiler changes, or
generation-metadata changes.

Review pointers:

- Original public polling bodies:
[Files](https://github.com/openai/openai-python/blob/bedb9a7b8839e193107e88b92f7cc166f08ac83d/src/openai/resources/vector_stores/files.py#L360)
and
[FileBatches](https://github.com/openai/openai-python/blob/bedb9a7b8839e193107e88b92f7cc166f08ac83d/src/openai/resources/vector_stores/file_batches.py#L331),
with the corresponding async methods in the same files.
- [SDK-owned
helper](https://github.com/openai/openai-python/blob/25e95b31c1402b3a927cedb9fff5d3d7a785bbeb/src/openai/lib/_vector_stores.py#L16):
the four bodies only rename their receiver and replace the repeated
interval block with the shared lookup. Source/AST comparison against the
base verifies those edits and the unchanged remainder of both resources.
- [Focused
tests](https://github.com/openai/openai-python/blob/25e95b31c1402b3a927cedb9fff5d3d7a785bbeb/tests/lib/test_vector_store_polling.py#L47):
106 lines / 22 cases covering the four public entry points, terminal
results, default/server/explicit intervals and headers, retrieval
errors, and async cancellation. Existing API and helper-signature tests
are unchanged.

## Additional context & links

Validation:

- Commands: `.venv/bin/python -m pytest
tests/lib/test_vector_store_polling.py -q -n 0` and the same command
with `.venv-pydantic-v1/bin/python` passed all **22 cases against the
original implementation and again after extraction**.
- Commands: `TEST_API_BASE_URL=http://127.0.0.1:4142 .venv/bin/python -m
pytest tests/api_resources/vector_stores
tests/lib/test_vector_store_files.py
tests/lib/test_vector_store_file_batches.py
tests/lib/test_vector_store_polling.py -q -n 0` and the same command
with `.venv-pydantic-v1/bin/python` passed **248 tests in each Pydantic
mode**.
- Commands: `./scripts/format` and `./scripts/lint` passed, including
Ruff, Pyright, mypy, and import checks. Unrelated reporter-formatting
edits were excluded.
- Command: `./scripts/build` passed. Both distributions include the
helper, and a fresh import from the built wheel loads the helper and all
four resource classes.

The verified custom-code report keeps **36 mixed files**, with only the
two vector-store resource customizations changed:

- `files.py`: **+222/-4 to +179/-1**.
- `file_batches.py`: **+275/-4 to +242/-3**.

All other 34 customizations, generation metadata, API reference,
dependencies, and workflows are unchanged. Reproduction command:

```sh
python3 scripts/castiron/custom_code_report.py report \
  --base bedb9a7 \
  --head 25e95b3 \
  --fetch --require-head-hash --public \
  --out /tmp/castiron-vector-polling
```
…3712)

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

## Changes being requested

Move the existing sync and async file-processing polling bodies into
SDK-owned `lib/_files.py`. `Files.wait_for_processing` and
`AsyncFiles.wait_for_processing` keep their public signatures, defaults,
docstrings, and return types, and delegate to the helpers. No schema,
compiler, dependency, or generation-metadata changes are needed.

The polling bodies are unchanged apart from renaming the receiver from
`self` to `files`. This preserves the `processed`/`error`/`deleted`
terminal states, wall-clock timing, dynamic `retrieve` and `_sleep`
hooks, return identity, and exact errors. In particular, the strict `>`
timeout check still happens after a repeated retrieval, even if that
retrieval returns a terminal state. This does not introduce a generic
polling framework or change existing timeout behavior.

Review pointers:

- Original public methods:
[sync](https://github.com/openai/openai-python/blob/bedb9a7b8839e193107e88b92f7cc166f08ac83d/src/openai/resources/files.py#L366)
and
[async](https://github.com/openai/openai-python/blob/bedb9a7b8839e193107e88b92f7cc166f08ac83d/src/openai/resources/files.py#L720).
- [Extracted
bodies](https://github.com/openai/openai-python/blob/3dfdf85e4d33a3274270aadccda6278c41ac8ede/src/openai/lib/_files.py#L12).
- [Focused regression
tests](https://github.com/openai/openai-python/blob/3dfdf85e4d33a3274270aadccda6278c41ac8ede/tests/lib/test_file_processing.py#L36):
13 cases covering sync/async terminal results, polling, timeout and
retrieval-error propagation, plus async cancellation.

Following the [review
discussion](#3712 (comment)),
the new handwritten suite is limited to 87 lines rather than an
exhaustive matrix of clock, timeout, and event-order details. Existing
Files API tests are unchanged. The review revision changes only this new
test file; runtime source remains byte-identical to the original PR
head.

## Additional context & links

Validation:

- Commands: `TEST_API_BASE_URL=http://127.0.0.1:4141 .venv/bin/python -m
pytest tests/lib/test_file_processing.py
tests/api_resources/test_files.py -q -n 0` and the same command using
`.venv-pydantic-v1/bin/python`: **130 passed, 3 skipped** in each
Pydantic mode. The skips are the existing aiohttp/respx2-incompatible
`test_method_content`, `test_raw_response_content`, and
`test_streaming_response_content` cases.
- Commands: `.venv/bin/ruff format tests/lib/test_file_processing.py`
and `./scripts/lint` passed on the review revision, including Ruff,
Pyright, mypy, and import checks. The initial full `./scripts/format`
also passed; unrelated reporter-formatting changes were excluded.
- Command: `./scripts/build` passed. Both the wheel and source
distribution contain `openai/lib/_files.py`; importing the helper and
resource classes from the built wheel also passed.
- Exact source/AST comparison against the base verified both polling
bodies, all other resource statements, public signatures, exports,
request construction, and response wrappers.

The verified custom-code report keeps 36 mixed files and changes only
the Files resource customization, shrinking it from **+47/-0 to
+26/-0**. The other 35 customizations are unchanged. Reproduction
command:

```sh
python3 scripts/castiron/custom_code_report.py report \
  --base bedb9a7 \
  --head 3dfdf85 \
  --fetch --require-head-hash --public \
  --out /tmp/castiron-file-processing
```
@pull pull Bot locked and limited conversation to collaborators Aug 21, 2026
@pull pull Bot added the ⤵️ pull label Aug 21, 2026
@pull
pull Bot merged commit 5f20c51 into gitupdates:main Aug 21, 2026
8 of 9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant