Skip to content

fix: bound vector store file polling - #3401

Merged
marcuswood-oai merged 2 commits into
openai:mainfrom
he-yufeng:fix/vector-store-file-poll-timeout
Sep 10, 2026
Merged

fix: bound vector store file polling#3401
marcuswood-oai merged 2 commits into
openai:mainfrom
he-yufeng:fix/vector-store-file-poll-timeout

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Fixes #3097

Summary

  • add an optional max_wait_seconds bound to vector_stores.files.poll()
  • thread the same bound through sync/async create_and_poll() and upload_and_poll()
  • raise TimeoutError instead of waiting forever when a vector store file stays in_progress

Why

upload_and_poll() currently waits until the vector store file reaches a terminal state. If the backend leaves the vector store file in in_progress indefinitely, 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 -q

  • PYTHONPATH=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 -q

  • PYTHONPATH=src python -m ruff check src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.py

  • python -m compileall -q src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.py

  • git diff --check

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

@he-yufeng
he-yufeng requested a review from a team as a code owner June 14, 2026 03:37
@he-yufeng

Copy link
Copy Markdown
Contributor Author

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.

@he-yufeng

Copy link
Copy Markdown
Contributor Author

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.

@github-actions

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

43 mixed files remain; 1 existing customization changed.

Compared 8f84fbd688bd662c03d2b7a8. Generated baselines verified.

File Result Current custom patch
src/openai/resources/vector_stores/files.py Existing customization changed +220 / −1
42 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/openai/init.py
  • src/openai/_client.py
  • src/openai/resources/audio/transcriptions.py
  • src/openai/resources/audio/translations.py
  • src/openai/resources/beta/agents/sessions/sessions.py
  • src/openai/resources/beta/beta.py
  • src/openai/resources/beta/responses/responses.py
  • src/openai/resources/beta/threads/runs/runs.py
  • src/openai/resources/beta/threads/threads.py
  • src/openai/resources/chat/completions/completions.py
  • src/openai/resources/embeddings.py
  • src/openai/resources/files.py
  • src/openai/resources/live/forks.py
  • src/openai/resources/live/live.py
  • src/openai/resources/live/sideband.py
  • src/openai/resources/realtime/realtime.py
  • src/openai/resources/responses/responses.py
  • src/openai/resources/uploads/uploads.py
  • src/openai/resources/vector_stores/file_batches.py
  • src/openai/resources/videos.py
  • src/openai/resources/webhooks/init.py
  • src/openai/resources/webhooks/webhooks.py
  • src/openai/types/beta/agent_session_message.py
  • src/openai/types/chat/init.py
  • src/openai/types/chat/chat_completion_message_tool_call.py
  • src/openai/types/fine_tuning/fine_tuning_job_integration.py
  • src/openai/types/responses/init.py
  • src/openai/types/responses/response.py
  • src/openai/types/responses/response_function_web_search.py
  • src/openai/types/responses/response_function_web_search_param.py
  • src/openai/types/responses/responses_client_event.py
  • src/openai/types/responses/responses_client_event_param.py
  • src/openai/types/responses/tool.py
  • src/openai/types/responses/tool_param.py
  • src/openai/types/webhooks/init.py
  • src/openai/types/webhooks/live_call_incoming_webhook_event.py

2 more in the full report.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download 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.patch

Or 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.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@marcuswood-oai
marcuswood-oai merged commit ae41bc4 into openai:main Sep 10, 2026
16 checks passed
@openai-sdks openai-sdks Bot mentioned this pull request Sep 10, 2026
@marcuswood-oai

Copy link
Copy Markdown
Contributor

Thanks for the fix! Merged with a few refinements and regression coverage for both sync and async polling.

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.

vector_stores.files.upload_and_poll() can hang indefinitely with file status stuck at in_progress

2 participants