Commit 88fd692
fix(chunking): Propagate CancelledError ahead of transient siblings
`_fan_out_rest` previously walked `failures` looking for the first
recognized transient and wrapped it as `ChunkInterrupted`. If a
sibling sub-request happened to raise `asyncio.CancelledError`
alongside (or after) a transient HTTPError, the transient was
classified first and the cancellation was silently consumed — the
user's stop signal got rewritten as a "retry me" handle.
Adds a pre-walk that propagates any non-`Exception` BaseException
(`CancelledError`, `KeyboardInterrupt`, `SystemExit`) unmodified
before the transient-classification walk runs. asyncio's
cancellation contract takes precedence over the chunker's retry
semantics.
Regression test: `test_async_fan_out_cancellation_wins_over_transient_sibling`
deterministically sequences a 3-call fan-out (probe + transient +
CancelledError) by relying on gather's submission-order scheduling
when the inner fetch_async has no awaits. Pre-fix the test got
`ServiceInterrupted`; post-fix it gets `CancelledError`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 6028dd5 commit 88fd692
2 files changed
Lines changed: 54 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1462 | 1462 | | |
1463 | 1463 | | |
1464 | 1464 | | |
1465 | | - | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
1471 | 1479 | | |
1472 | 1480 | | |
1473 | 1481 | | |
1474 | 1482 | | |
1475 | 1483 | | |
1476 | 1484 | | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1477 | 1488 | | |
1478 | 1489 | | |
1479 | 1490 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1464 | 1464 | | |
1465 | 1465 | | |
1466 | 1466 | | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
1467 | 1504 | | |
1468 | 1505 | | |
1469 | 1506 | | |
| |||
0 commit comments