mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 19:07:41 +00:00
undici's HTTP/1 writer calls socket.setTypeOfService before each write, outside any fetch promise. On macOS the syscall fails with EINVAL once the peer has reset the socket (VPN, Wi-Fi switch, proxy), so a network change became an uncaught main-process exception and a modal error dialog. Treat the TOS syscall as best effort, as Node already does on Windows; the write then fails through undici's normal ECONNRESET path. Argument validation errors still throw. The test resets a real peer connection and calls setTypeOfService on the reset socket, reproducing the native EINVAL on macOS. Fixes #39579 Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>