fix(openai): bound embedding batch file downloads#98554
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 1, 2026, 9:54 AM ET / 13:54 UTC. Summary PR surface: Source +123, Tests +256. Total +379 across 2 files. Reproducibility: yes. at source/proof level: current main reads OpenAI batch output file content with Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure. Do we have a high-confidence way to reproduce the issue? Yes at source/proof level: current main reads OpenAI batch output file content with Is this the best way to solve the issue? Yes. Streaming JSONL with a per-line byte cap plus a group-length/custom-id stop is the narrow OpenAI-plugin fix; a shared whole-response cap would break valid large outputs, and broadening this PR to Google or Voyage would mix sibling provider work into an otherwise focused repair. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 634a02e9e6a3. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +123, Tests +256. Total +379 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
f990ade to
eac7a7b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
vincentkoc
left a comment
There was a problem hiding this comment.
Reviewed the refreshed head after updating onto current main. The streaming JSONL approach preserves valid large embedding batch outputs while bounding malformed single-record growth; accepting the per-record cap / fail-closed behavior for OpenAI-compatible batch output.
* fix(openai): bound embedding batch file downloads * fix(openai): bound batch output records --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(openai): bound embedding batch file downloads * fix(openai): bound batch output records --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(openai): bound embedding batch file downloads * fix(openai): bound batch output records --------- Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes an issue where OpenAI-compatible embedding batch runs could buffer an unbounded batch output or error file response when downloading
/files/{id}/content, without adding a whole-file cap that breaks valid large batch outputs.Why This Change Was Made
The successful batch output path now streams JSONL one record at a time and caps each output line, so valid large output files can still complete while malformed oversized lines are cancelled early. Batch status and error file reads continue to use bounded response readers.
User Impact
Users running large OpenAI-compatible embedding batches keep working, and a faulty or hostile provider endpoint cannot stream an unbounded single output record into gateway memory.
Evidence
Real loopback HTTP proof: a local
node:httpserver drove the productionrunOpenAiEmbeddingBatchespath through/files/{id}/content. One run streamed a valid 18,876,149-byte JSONL output and completed; the negative-control run streamed a no-newline oversized record and was cancelled after 8 of 1024 MiB chunks.AI-assisted: built with Codex