The Responses API has no [DONE] sentinel, so codex closes the socket as soon as response.completed arrives. That cancels the reader before flush() runs — and flush() held every usage side effect, so a fully successful request logged nothing: no 📊 done line, no token stats, no request detail. Extract that tail into a once-guarded finalizeStream() and also call it right after the terminal event is forwarded, in both passthrough and translate mode. flush() still calls it; the guard makes the second call a no-op. Streams that end normally are unaffected, and a terminal event carrying no usage falls through to the existing estimate/null path rather than blocking. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
20 KiB
20 KiB