Commit 33aafa0
fix(server): finalize native-passthrough request log on client cancel (#44)
Native-passthrough SSE is inspected on a teed background stream; Codex disconnects
the instant it finishes reading, aborting that stream. consumeForInspection took
the cancelled path and dropped the /api/logs entry (early-abort returned before
onDone; mid-drain abort suppressed onTerminal). Add an onCancel finalizer fired on
both abort branches (idempotent via finalizeNativePassthroughLog's logged guard),
run onDone on early-abort, and stop reportNativeTerminal from downgrading a real
detected terminal to a cancel — so a turn logs completed/failed when it finished,
499 client_cancel only on a pure cancel. Exactly one entry per turn.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 6b5daee commit 33aafa0
2 files changed
Lines changed: 73 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
444 | 444 | | |
445 | 445 | | |
446 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
447 | 451 | | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
456 | 463 | | |
457 | 464 | | |
458 | 465 | | |
| |||
1302 | 1309 | | |
1303 | 1310 | | |
1304 | 1311 | | |
1305 | | - | |
| 1312 | + | |
1306 | 1313 | | |
1307 | 1314 | | |
1308 | 1315 | | |
1309 | 1316 | | |
1310 | 1317 | | |
| 1318 | + | |
1311 | 1319 | | |
1312 | 1320 | | |
1313 | 1321 | | |
| |||
1316 | 1324 | | |
1317 | 1325 | | |
1318 | 1326 | | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
1319 | 1330 | | |
1320 | 1331 | | |
| 1332 | + | |
| 1333 | + | |
1321 | 1334 | | |
1322 | 1335 | | |
1323 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
1324 | 1339 | | |
1325 | 1340 | | |
| 1341 | + | |
1326 | 1342 | | |
1327 | 1343 | | |
1328 | 1344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments