Skip to content

fix(server): cancel failed embedding response bodies - #1232

Merged
mldangelo-oai merged 2 commits into
openai:mainfrom
sylvesterkaczmarek:fix/cancel-failed-embedding-response-bodies
Oct 5, 2026
Merged

mldangelo-oai merged 2 commits into
openai:mainfrom
sylvesterkaczmarek:fix/cancel-failed-embedding-response-bodies

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cancel unread error responses from the embedding provider. Without cleanup, an open-ended response stays connected after the embedding operation rejects.

Changes

Start body cancellation before throwing the existing HTTP error. Handle cleanup rejections without awaiting cancellation, so cleanup cannot replace or delay the provider failure.

Reuse the existing embedding fixture and tests to cover completed, rejected, and stalled cancellation, plus responses without bodies. Existing tests cover successful embedding responses.

Testing

  • Embedding and findings-client retry tests: 28 passed with seed 12345.
  • Removing the cleanup line makes all three cancellation regressions fail.
  • Node 24 local HTTP reproduction: the base leaves an open-ended 503 response connected; the fix closes it while preserving the same HTTP error.
  • Node 24 checks for completed, rejected, and stalled cancellation, an absent body, and successful vector parsing passed.
  • SDK type checks, build:ci, formatting, and git diff --check passed.
  • Full SDK and cross-platform checks run in CI.

Risk and rollout

The production change is one line and only affects unsuccessful embedding responses. It adds no public API, retry, credential, or logging changes. Verification uses synthetic credentials and local fixtures; no live provider calls were made.

Public disclosure review

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
@github-actions github-actions Bot added the bug Something isn't working label Oct 4, 2026

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the actual PR diff at 560f41988718ee4453fff3a9f121378664192f82 against explicit base 1fb0e5fbf8684c926cac2a36d08389b212d28d5a with three independent HIGH full-diff passes and root synthesis, including every changed test and fixture. No supported introduced issue was identified.

Read all125 actual diff lines, complete embedding implementation and the new test/fixture. Error-response cancellation is initiated without awaiting cleanup, and rejection/pending cleanup does not replace the HTTP error in the touched implementation. Tests were inspected, not executed; no live provider or stream run.

Static source review only; no local tests, builds, release operations or models were run. Source approval does not establish current CI, integration or deployment.

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fix is necessary: this class owns the embedding response, and the findings-client cleanup handles a separate HTTP request. A Node 24 local HTTP reproduction leaves an open-ended 503 response connected on the base and closes it with this change while preserving the same error.

No blocking correctness findings. The cancellation must remain unawaited so stalled cleanup cannot delay the provider error, and the rejection handler prevents cleanup from replacing it. All 29 embedding/cleanup/client-retry tests passed on this head; type checks, formatting, and build:ci also passed. Broader CI is still running.

The standalone fixture and successful-response test can be removed by folding the new cases into the existing embedding suite. That test-only simplification is prepared locally and preserves the cancellation regressions.

@mldangelo-oai mldangelo-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the final head, including the consolidated tests. No blocking findings. The one-line production fix is necessary, and reusing the existing embedding suite removes 80 lines while preserving the cancellation regressions.

Validation: 28 focused tests passed; removing the cleanup line fails all three cancellation cases. A Node 24 HTTP reproduction confirms that the fix closes an open-ended error response while preserving the provider error. Type checks, build:ci, formatting, and diff checks passed.

The full randomized local SDK run finished with 3,560 passes, 61 skips, and one unrelated baseline failure that also reproduces on unchanged main. Final-head CI is still running; merge should wait for its required checks.

@alandelong-oai alandelong-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the complete actual diff at 2c3d766 against 1fb0e5f, including both changed files and the changed tests, with three independent high-reasoning passes and root synthesis. No actionable introduced findings remained.

Static source review only; I did not run tests, builds or models. The change starts cancellation of non-OK response bodies without waiting for cleanup and preserves the HTTP error for absent, rejected or pending cleanup. CI, integration and deployment remain separate checks.

@mldangelo-oai
mldangelo-oai merged commit a767478 into openai:main Oct 5, 2026
55 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants