Treat a connection the peer closed as a dropped stream - #179
Merged
Conversation
Six of 35 benchmark trials died on "peer closed connection without sending TLS close_notify", each after 25 to 58 calls of good work. It is the provider's mid-stream 504 seen from our side of the socket. Before any delta it is sent again under the one existing bound; after a delta the stream reports it as dropped and the loop asks again. A timeout is still not retried anywhere. Claude-Session: https://claude.ai/code/session_01ADjombyM8oH114zG9FnMxo
…n-is-a-dropped-stream # Conflicts: # docs/DECISIONS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Six of 35 benchmark trials on OpenRouter's free providers ended with
peer closed connection without sending TLS close_notify, each after 25 to 58 tool calls of good work. rustls reports it as anUnexpectedEofon the body read, and nothing retried it because the retry rule was written about status codes. It is the same event as the provider's own mid-stream 504, seen from our side.What
zorp::connection_droppedrecognises a closed connection by the io error kind in the chain (UnexpectedEof,ConnectionReset,ConnectionAborted,BrokenPipe) and refuses when a timeout is underneath.send_json_retryingre-sends a dropped connection under the sameRetryingbound and backoff, saying so on stderr. One bound, one count of sends.stream_ssereports a dropped connection asInStreamError::Dropped(nowDroppedBy::ProviderorDroppedBy::Transport), so the existing loop re-ask handles it after deltas and the existingRetryingpath handles it before any. Provider Display unchanged.read_error's clock rule is untouched.Reset { after },ResetBeforeHeadersandQuiet { after }. Tests count connections: two deltas then a reset then an answer (two connections, one assistant message, the "asking again" line); reset before headers then an answer (two connections); reset on every connection (exactlyZORP_RETRY_ATTEMPTSconnections, error names the bound); a read timeout is not re-sent.docs/DECISIONS.mdgets a 2026-09-05 entry and the 2026-08-23 entry an Amended by line.CLAUDE.mdandAGENTS.mdupdated in sync.Tests
cargo test -p zorp59 to 60,cargo test -p zorp-agent607 to 611, withresearch804 to 808. fmt, clippy-D warningsandcargo build --workspacepass.https://claude.ai/code/session_01ADjombyM8oH114zG9FnMxo