mirror of
https://github.com/langgenius/dify.git
synced 2026-07-14 17:07:03 +08:00
Follow-ups from code review: - Transport: treat a non-positive timeout (0/negative) as disabled so a 0-second watchdog can never arm; add a post-stream backstop that raises FirstTokenTimeoutError when aborting the socket ends the stream with a clean EOF instead of a transport error; only raise when no token was delivered. - Watchdog: make fire/disarm mutually exclusive with a lock, so a token arriving on the deadline is never both yielded and aborted and `fired` reliably means "timed out before the first token". - Adapter: extract the shared set/reset-ContextVar logic into one helper. - i18n: fix nodes.common.retry.ms, mistranslated as the "Ms./Mrs." honorific in 9 locales (de/es/hi/th/pl/tr/vi/id/ro; uk lowercased). - Tests: real-socket test proving socket.shutdown unblocks a blocked httpx iter_lines and surfaces a real RequestError; a clean-EOF backstop test; a 0=disabled test; and NaN/negative-clamp + preserve-other-fields assertions.