Repository navigation
fix(agents): preserve sanitized stream cancellation - #110427
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 5:45 PM ET / 21:45 UTC. Summary PR surface: Source +9, Tests +52. Total +61 across 2 files. Reproducibility: no. high-confidence live reproduction is provided. The source path and focused test clearly model a rejecting upstream Review metrics: none identified. 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the shared cleanup helper and add redacted terminal output, runtime logs, or a reproducible live stream artifact showing that a rejecting source cancellation does not reject downstream cancellation while normal stream cleanup still completes. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is provided. The source path and focused test clearly model a rejecting upstream Is this the best way to solve the issue? Yes, subject to real behavior proof. A single helper makes the cleanup-only error policy explicit and avoids leaving sanitizer and capped-response wrappers with divergent cancellation semantics. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fa9ae68c3423. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +52. Total +61 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
Review history (7 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
7f64c70 to
d964b2f
Compare
Co-authored-by: zenglingbiao <[email protected]>
|
Merged via squash.
|
* fix(agents): add .catch() to reader.cancel() to prevent unhandled rejection * fix(agents): preserve sanitized stream cancellation Co-authored-by: zenglingbiao <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
* fix(agents): add .catch() to reader.cancel() to prevent unhandled rejection * fix(agents): preserve sanitized stream cancellation Co-authored-by: zenglingbiao <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
Centralize best-effort reader cancellation for guarded OpenAI-compatible response streams. Successful JSON-to-SSE and SSE sanitizer wrappers now preserve intentional downstream cancellation when an upstream source's cancellation algorithm rejects.
Problem
Web Streams forwards an underlying source's cancellation failure through
reader.cancel(). These two sanitizer wrappers returned that secondary teardown failure, so the OpenAI SDK's awaited iterator cleanup could escape or mask the consumer's intended cancellation.Canceling an already-closed stream resolves normally; the relevant failure case is a rejecting underlying cancellation algorithm.
Fix
cancelReaderBestEfforthelper with the teardown invariant documented at its owner boundary.Evidence
2598a07542f9643ad2f98ea1d051b8d164fc6a81.No config, request, routing, SSRF, provider-selection, protocol, or normal stream-consumption behavior changes.