fix: bound vector store file polling - #3401
Conversation
|
Bumping this. It bounds the vector-store file-polling loop so a file stuck in-progress doesn't poll indefinitely. Small and contained. Happy to rebase if useful. |
|
One thing I missed earlier: files.py now carries the Castiron generated-file header. If this bound should land in the generator or the spec instead, point me at it and I will rework the change there. The unbounded-poll behavior itself is still present on main. |
Castiron custom code✅ No new custom-code files detected. 43 mixed files remain; 1 existing customization changed. Compared
42 existing customizations unchanged
2 more in the full report. A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 34535119857 --repo openai/openai-python \
--name castiron-custom-code-34535119857-1 --dir /tmp/castiron-custom-code-34535119857-1
git apply --stat /tmp/castiron-custom-code-34535119857-1/custom-code.patch
cat /tmp/castiron-custom-code-34535119857-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 8f84fbd688bdd8a9cde17c09f79b34d5d5580f0f 662c03d2b7a8c8ca16a031977d68415921068dbb
python3 scripts/castiron/custom_code_report.py report \
--base 8f84fbd688bdd8a9cde17c09f79b34d5d5580f0f \
--head 662c03d2b7a8c8ca16a031977d68415921068dbb --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-662c03d2b7a8
cat /tmp/castiron-custom-code-662c03d2b7a8/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
|
Thanks for the fix! Merged with a few refinements and regression coverage for both sync and async polling. |
Fixes #3097
Summary
max_wait_secondsbound tovector_stores.files.poll()create_and_poll()andupload_and_poll()TimeoutErrorinstead of waiting forever when a vector store file staysin_progressWhy
upload_and_poll()currently waits until the vector store file reaches a terminal state. If the backend leaves the vector store file inin_progressindefinitely, the helper never returns and the caller has no SDK-level escape hatch. The new argument keeps the default behavior unchanged, while letting callers opt into a bounded wait.Validation
PYTHONPATH=src python -m pytest tests/api_resources/vector_stores/test_files.py::TestFiles::test_poll_timeout tests/api_resources/vector_stores/test_files.py::TestAsyncFiles::test_poll_timeout -qPYTHONPATH=src python -m pytest tests/api_resources/vector_stores/test_files.py::test_create_and_poll_method_in_sync tests/api_resources/vector_stores/test_files.py::test_upload_and_poll_method_in_sync -qPYTHONPATH=src python -m ruff check src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.pypython -m compileall -q src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.pygit diff --checkI understand that this repository is auto-generated and my pull request may not be merged