[codex] Add timeout for vector store file polling#3429
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc3bae29e2
ℹ️ 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".
| if time.time() - start > max_wait_seconds: | ||
| raise RuntimeError( | ||
| f"Giving up on waiting for vector store file {file_id} to finish processing after {max_wait_seconds} seconds." | ||
| ) |
There was a problem hiding this comment.
Bound sleep duration by remaining timeout
Because the timeout is checked only before sleeping, a large poll_interval_ms or openai-poll-after-ms value can make the new limit ineffective: for example max_wait_seconds=5 with a 60s poll interval will pass this check and then block for the full 60s before it can raise. Cap the next sleep to the remaining budget, or re-check the deadline before sleeping; the async poll helper mirrors the same pattern.
Useful? React with 👍 / 👎.
|
Follow-up on the Codex P2 timeout review: this is addressed in I re-ran the focused coverage after checking the current branch: |
Summary
max_wait_secondsto vector store filepoll,create_and_poll, andupload_and_pollhelpersfiles.wait_for_processing()RuntimeErrorinstead of waiting forever when a vector store file remainsin_progressFixes #3097
Tests
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy uv run --with pytest --with pytest-asyncio --with respx --with rich pytest -o addopts='' tests/api_resources/vector_stores/test_files.py::TestFiles::test_poll_times_out_for_stuck_in_progress tests/api_resources/vector_stores/test_files.py::TestAsyncFiles::test_poll_times_out_for_stuck_in_progress 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 -quv run --with ruff ruff check src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.pyuv run --with ruff ruff format --check src/openai/resources/vector_stores/files.py tests/api_resources/vector_stores/test_files.pygit diff --check