Commit 5c2b49d
committed
fix(session): classify transport and timeout errors as retryable
MessageV2.fromError previously only treated ECONNRESET as retryable and
classified everything else (including transient transport failures) as a
hard error. Broaden it so a network blip recovers instead of failing the
session:
- transient SystemError codes (ECONNRESET, ETIMEDOUT, ENOTFOUND,
EAI_AGAIN, ECONNREFUSED, EHOSTUNREACH, ENETUNREACH, EPIPE)
- DOMException TimeoutError (AbortSignal.timeout)
- bare network-error Error messages (fetch failed, socket hang up, SSE
read timed out, terminated, other side closed, ...)
A bare AbortError stays a cancel (classified by error identity, not an
external flag), so user cancellation is never retried.
Verified with unit tests in message-v2.test.ts covering each code,
message pattern, and the abort/timeout distinction.1 parent 2e71292 commit 5c2b49d
2 files changed
Lines changed: 113 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
614 | 634 | | |
615 | 635 | | |
616 | 636 | | |
617 | 637 | | |
| 638 | + | |
618 | 639 | | |
619 | 640 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
625 | 660 | | |
626 | 661 | | |
627 | 662 | | |
| |||
633 | 668 | | |
634 | 669 | | |
635 | 670 | | |
636 | | - | |
| 671 | + | |
637 | 672 | | |
638 | 673 | | |
639 | | - | |
| 674 | + | |
640 | 675 | | |
641 | 676 | | |
642 | | - | |
| 677 | + | |
643 | 678 | | |
644 | 679 | | |
645 | 680 | | |
| |||
710 | 745 | | |
711 | 746 | | |
712 | 747 | | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
713 | 757 | | |
714 | 758 | | |
715 | 759 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1551 | 1551 | | |
1552 | 1552 | | |
1553 | 1553 | | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
1554 | 1615 | | |
1555 | 1616 | | |
1556 | 1617 | | |
| |||
0 commit comments