Skip to content

fix(polling): honor cancellation during polling delays - #2477

Open
HAYDEN-OAI wants to merge 2 commits into
mainfrom
autoimprove/polling-caller-abort-c676-mt9ayu2z
Open

fix(polling): honor cancellation during polling delays#2477
HAYDEN-OAI wants to merge 2 commits into
mainfrom
autoimprove/polling-caller-abort-c676-mt9ayu2z

Conversation

@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

Summary

  • Honor the documented caller RequestOptions.signal immediately during intermediate assistant-run and vector-store polling delays, including default, server-provided, and custom intervals.
  • Reject with APIUserAbortError and preserve the exact caller abort reason as its non-enumerable cause; safely clear the timer and only the polling-owned listener across completion, pre-abort, missed-event, and synchronous registration races.
  • Preserve existing terminal/unknown status handling, header and getter ordering, no-signal sleep behavior, unrelated abort listeners, and structural AbortSignal compatibility.
  • Exercise all three actual public polling methods and all seven public create, upload, and submit-tool-output polling delegates.

Validation

  • Node 22.22.0 and Node 24.19.0: 96 focused tests on each runtime.
  • Full handwritten suite: 149 files and 6,314 passing tests.
  • Full generated suite: 82 files and 556 passing tests against an isolated mock server.
  • Repository formatting/lint, strict TypeScript, package build, published TypeScript 4.9 and current TypeScript declarations, and publint.
  • Existing packed-package CommonJS/ESM and source-map checks, plus actual built CommonJS and ESM public polling cancellation regressions.

@HAYDEN-OAI
HAYDEN-OAI requested a review from a team as a code owner August 25, 2026 23:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 25, 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 ⚠️ Failed 2026-08-26T00:01:37.751094Z 87bb5fc New commits
🔒 Security Review Completed 2026-08-26T00:00:26.990823Z 87bb5fc 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.

@openai-sdks

openai-sdks Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

OkTest Summary

237/237 SDK tests passed in 12.063s for Node SDK PR #2477.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 255ms
tests/chat-completions-create.test.ts ✅ Passed 256ms
tests/chat-completions-stream.test.ts ✅ Passed 313ms
tests/files-content-binary.test.ts ✅ Passed 181ms
tests/files-create-multipart.test.ts ✅ Passed 184ms
tests/files-list-pagination.test.ts ✅ Passed 223ms
tests/initialize-config.test.ts ✅ Passed 306ms
tests/instance-isolation.test.ts ✅ Passed 143ms
tests/models-list.test.ts ✅ Passed 186ms
tests/responses-background-lifecycle.test.ts ✅ Passed 203ms
tests/responses-body-method-errors.test.ts ✅ Passed 464ms
tests/responses-cancel-timeout.test.ts ✅ Passed 262ms
tests/responses-cancel.test.ts ✅ Passed 271ms
tests/responses-compact-retries.test.ts ✅ Passed 307ms
tests/responses-compact.test.ts ✅ Passed 238ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 221ms
tests/responses-create-advanced.test.ts ✅ Passed 238ms
tests/responses-create-disconnect.test.ts ✅ Passed 1.104s
tests/responses-create-errors.test.ts ✅ Passed 277ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 280ms
tests/responses-create-retries.test.ts ✅ Passed 377ms
tests/responses-create-stream-failures.test.ts ✅ Passed 280ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 2.166s
tests/responses-create-stream-wire.test.ts ✅ Passed 2.662s
tests/responses-create-stream.test.ts ✅ Passed 95ms
tests/responses-create-terminal-states.test.ts ✅ Passed 297ms
tests/responses-create-timeout.test.ts ✅ Passed 248ms
tests/responses-create.test.ts ✅ Passed 356ms
tests/responses-delete.test.ts ✅ Passed 299ms
tests/responses-input-items-errors.test.ts ✅ Passed 282ms
tests/responses-input-items-list.test.ts ✅ Passed 190ms
tests/responses-input-items-options.test.ts ✅ Passed 208ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 299ms
tests/responses-input-tokens-count.test.ts ✅ Passed 258ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.304s
tests/responses-not-found-errors.test.ts ✅ Passed 413ms
tests/responses-parse.test.ts ✅ Passed 295ms
tests/responses-retrieve-retries.test.ts ✅ Passed 372ms
tests/responses-retrieve.test.ts ✅ Passed 287ms
tests/responses-stored-method-errors.test.ts ✅ Passed 660ms
tests/retry-behavior.test.ts ✅ Passed 3.183s
tests/sdk-error-shape.test.ts ✅ Passed 414ms

View OkTest run #32913119840

SDK merge (067045fdc8d4) · head (87bb5fcfc022) · base (c6769fa9b28b) · OkTest (2b1bdfd25e98)

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

32 mixed files remain; 0 existing customizations changed.

Compared c6769fa9b28b87bb5fcfc022. Generated baselines verified.

32 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/client.ts
  • src/resources/audio/transcriptions.ts
  • src/resources/audio/translations.ts
  • src/resources/beta/assistants.ts
  • src/resources/beta/beta.ts
  • src/resources/beta/index.ts
  • src/resources/beta/responses/internal-base.ts
  • src/resources/beta/responses/responses.ts
  • src/resources/beta/threads/index.ts
  • src/resources/beta/threads/runs/index.ts
  • src/resources/beta/threads/runs/runs.ts
  • src/resources/beta/threads/threads.ts
  • src/resources/chat/completions/completions.ts
  • src/resources/chat/completions/index.ts
  • src/resources/conversations/index.ts
  • src/resources/embeddings.ts
  • src/resources/files.ts
  • src/resources/fine-tuning/checkpoints/permissions.ts
  • src/resources/images.ts
  • src/resources/responses/internal-base.ts
  • src/resources/responses/responses.ts
  • src/resources/skills/skills.ts
  • src/resources/skills/versions/versions.ts
  • src/resources/vector-stores/file-batches.ts
  • src/resources/vector-stores/files.ts
  • src/resources/webhooks/index.ts
  • src/resources/webhooks/webhooks.ts
  • tests/lib/data-residency.test.ts

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 32913150326 --repo openai/openai-node \
  --name castiron-custom-code-32913150326-1 --dir /tmp/castiron-custom-code-32913150326-1
git apply --stat /tmp/castiron-custom-code-32913150326-1/custom-code.patch
cat /tmp/castiron-custom-code-32913150326-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin c6769fa9b28bbc6f10be81e2f87e18655dfdd008 87bb5fcfc022f3f0e2877301f44773a332ef946e
python3 scripts/castiron/custom_code_report.py report \
  --base c6769fa9b28bbc6f10be81e2f87e18655dfdd008 \
  --head 87bb5fcfc022f3f0e2877301f44773a332ef946e --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-87bb5fcfc022
cat /tmp/castiron-custom-code-87bb5fcfc022/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

@jbeckwith-oai jbeckwith-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The cancellation and race coverage is otherwise strong, but supported structural/polyfilled AbortSignals can throw while removing the polling listener. That currently clears the only recovery timer without settling the poll, leaving every public polling helper permanently pending. Please make cleanup exception-safe and add abort and ordinary timer-completion regressions before landing.

Comment thread src/lib/polling.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants