fix(vector stores): refresh server poll intervals - #3775
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
I traced this through all four vector-store polling paths. The important part is that an omitted poll_interval_ms now remains omitted across iterations, so _get_poll_interval_ms(response.headers) is evaluated against each pending response instead of the first server hint becoming accidental caller state.
An explicit interval is still stable: it continues to set X-Stainless-Custom-Poll-Interval once and is selected on every iteration. When no server hint is present, _get_poll_interval_ms also preserves the existing 1000 ms fallback.
The two-response 100 ms -> 2000 ms regression directly pins the failure mode, and the shared parameterized test covers the sync/async file and file-batch entry points. I don't see a blocking behavior change beyond the intended response-scoped hint refresh.
|
Friendly follow-up at the one-week mark: this remains mergeable and ready for maintainer review. The parameterized regression covers all four sync/async file and file-batch polling paths, while preserving explicit intervals and the existing fallback. Please let me know if any adjustment or additional validation would help. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Rechecked the unchanged head after the follow-up. The four vector-store polling paths preserve omitted intervals so each pending response can refresh the server hint, while explicit intervals and the 1000 ms fallback remain stable. I do not see a remaining blocker.
…ynamic-poll-hints # Conflicts: # src/openai/lib/_vector_stores.py
|
Resolved the conflict with current main after #3401 added bounded file-polling deadlines. The updated branch preserves both behaviors: omitted poll intervals are read from each pending response, while file polling still caps every sleep at the remaining deadline. Validation on the merged head: 72 focused polling/deadline tests passed in both the default and Pydantic v1 lanes; Ruff check, Ruff format check, and git diff --check also passed. This was a normal merge and push, with no history rewrite. |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Rechecked merge head 22f88524. The conflict resolution preserves both behaviors: omitted poll intervals are still refreshed from each pending response, and file polling still caps each sleep at the remaining deadline. The focused polling/deadline coverage is appropriate. No blocker from me.
Changes being requested
When
poll_interval_msis omitted, the vector-store polling helpers currently assign the first response'sopenai-poll-after-msvalue back topoll_interval_ms. That makes the value appear caller-specified on later iterations, so subsequent server hints are ignored.For example, two pending responses with 100 ms and 2000 ms hints currently sleep for
[0.1, 0.1]seconds instead of[0.1, 2.0].This change keeps an explicitly supplied interval fixed, while resolving an omitted interval from every pending response. The behavior now matches the response-scoped hint handling in the other OpenAI SDK polling implementations.
The regression covers all four public vector-store polling paths:
FilesAsyncFilesFileBatchesAsyncFileBatchesAdditional context & links
The patch is limited to the SDK-owned
src/openai/lib/_vector_stores.pyhelper and its focused tests. It does not change any public signature, request header, terminal-state behavior, or generated resource file.Validation:
[0.1, 0.1]../scripts/lint: Ruff, Pyright, mypy, and import check passedgit diff --check: passed