Repository navigation
fix(server): cancel failed embedding response bodies - #1232
mldangelo-oai merged 2 commits into
Conversation
Signed-off-by: Sylvester Kaczmarek <16242628+sylvesterkaczmarek@users.noreply.github.com>
alandelong-oai
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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
build:ci, formatting, andgit diff --checkpassed.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