Commit 7263e05
Fix streaming reliability: BrokenPipeError, tool call visibility, keepalive
Three fixes for streaming reliability issues found in session
019eee1b-bbf5-7992-a133-f3a61c0ed3dc:
1. BrokenPipeError crash: When Codex aborts a turn, it closes the
connection. The proxy kept trying to write SSE events and crashed.
Now send_event() catches BrokenPipeError, sets client_alive=False,
and silently skips further writes. Prevents proxy crashes and
allows clean turn aborts.
2. Tool calls showing as "thinking": The reasoning item stayed
status=in_progress the entire time tool calls were being made.
The UI saw reasoning still active and showed "thinking" instead
of the tool calls. Now the reasoning item is closed (status=
completed) before emitting tool call output_item.added events.
3. SSE keepalive: When the upstream model thinks for 30+ seconds
before responding, Codex timed out waiting for content. Now a
background thread sends SSE comment lines (": keepalive") every
15s while waiting for the upstream first byte, keeping the
connection alive.
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent bc7528b commit 7263e05
1 file changed
Lines changed: 44 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | | - | |
201 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
202 | 211 | | |
203 | 212 | | |
204 | 213 | | |
205 | | - | |
206 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
| |||
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
241 | 268 | | |
242 | 269 | | |
| 270 | + | |
243 | 271 | | |
244 | 272 | | |
245 | 273 | | |
| |||
282 | 310 | | |
283 | 311 | | |
284 | 312 | | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
285 | 319 | | |
286 | 320 | | |
287 | 321 | | |
| |||
317 | 351 | | |
318 | 352 | | |
319 | 353 | | |
| 354 | + | |
320 | 355 | | |
321 | 356 | | |
322 | 357 | | |
| |||
328 | 363 | | |
329 | 364 | | |
330 | 365 | | |
| 366 | + | |
331 | 367 | | |
332 | 368 | | |
333 | 369 | | |
| |||
339 | 375 | | |
340 | 376 | | |
341 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
342 | 382 | | |
343 | 383 | | |
344 | 384 | | |
| |||
0 commit comments