fix(ai-gateway): close terminal stream errors - #4900
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryIncremental review of Verified in this pass
Files Reviewed (2 files)
Previous Review Summary (commit 8f04e16)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 8f04e16)Status: 1 Issue Found | Recommendation: Address before merge Executive SummaryThe terminal-error handling is correct and well covered by tests; the only concern is that the Chat Completions detection uses a key-presence check ( Overview
Issue Details (click to expand)SUGGESTION
Verified as correct
Files Reviewed (2 files)
Reviewed by claude-opus-5 · Input: 34 · Output: 4.4K · Cached: 643.5K Review guidance: REVIEW.md from base branch |
Problem
Provider-sent SSE error events were forwarded to clients but were not treated as terminal events. When the client disconnected in response, logs showed the cancellation without the terminal event that triggered it, and the stream stayed open until that cancellation or upstream EOF.
Fix
{error: ...}, Messagestype: "error", and Responsestype: "error"events as terminalreceived terminal stream eventloggerTesting
CI will validate the change.