Skip to content

fix(vector stores): refresh server poll intervals - #3775

Open
Hughhhhcoder wants to merge 2 commits into
openai:mainfrom
Hughhhhcoder:codex/openai-python-dynamic-poll-hints
Open

fix(vector stores): refresh server poll intervals#3775
Hughhhhcoder wants to merge 2 commits into
openai:mainfrom
Hughhhhcoder:codex/openai-python-dynamic-poll-hints

Conversation

@Hughhhhcoder

@Hughhhhcoder Hughhhhcoder commented Sep 1, 2026

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

Changes being requested

When poll_interval_ms is omitted, the vector-store polling helpers currently assign the first response's openai-poll-after-ms value back to poll_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:

  • Files
  • AsyncFiles
  • FileBatches
  • AsyncFileBatches

Additional context & links

The patch is limited to the SDK-owned src/openai/lib/_vector_stores.py helper and its focused tests. It does not change any public signature, request header, terminal-state behavior, or generated resource file.

Validation:

  • Before the fix, the new regression failed all 4 variants with [0.1, 0.1].
  • Focused Vector Store matrix:
    • Pydantic v2: 252 passed
    • Pydantic v1: 252 passed
  • Full non-functional test matrix:
    • Pydantic v2: 11,236 passed, 144 skipped
    • Pydantic v1: 11,222 passed, 158 skipped
  • ./scripts/lint: Ruff, Pyright, mypy, and import check passed
  • Castiron custom-code budget: passed, 6566 / 10000 lines; no new custom-code files or generated customizations
  • git diff --check: passed

@Hughhhhcoder
Hughhhhcoder requested a review from a team as a code owner September 1, 2026 10:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-11T06:09:41.120000Z 22f8852 New commits
🔒 Security Review Completed 2026-09-11T06:16:07.456249Z 22f8852 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Hughhhhcoder

Copy link
Copy Markdown
Author

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 sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@Hughhhhcoder

Copy link
Copy Markdown
Author

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 sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants