Skip to content

Fix bounded OCR dispatch retries for dropped connections and incomplete ACKs - #3

Merged
zehongye-gaga merged 1 commit into
mainfrom
fix/dispatch-network-retries
Nov 11, 2026
Merged

zehongye-gaga merged 1 commit into
mainfrom
fix/dispatch-network-retries

Conversation

@zehongye-gaga

Copy link
Copy Markdown
Collaborator

A dropped connection or truncated ACK could fail OCR dispatch after one HTTP request, even when the backend had received the submission. Retry connection resets, premature EOF, incomplete bodies and malformed JSON/UTF-8 with bounded exponential backoff and jitter. Detect short Content-Length bodies explicitly because a bounded HTTP read can return them without an exception.

Keep the existing maximum of four attempts and 90-second total deadline. Every attempt reuses the same snapshot request ID, payload and workflow rerun key. A v2 durable acceptance ACK ends the job immediately, without waiting for review completion or commit-status publication. Permanent HTTP errors, oversized responses and invalid response lengths still fail promptly.

Emit one structured log per request with attempt, request ID, elapsed milliseconds, HTTP status, error type and retry delay. Logs exclude credentials and response bodies.

Validation:

  • 25 tests pass on macOS/Python 3.9 and Linux/Python 3.13.5.
  • Real local HTTP tests cover lost ACKs, truncated fixed-length and chunked bodies, valid JSON with a short body, transient/permanent HTTP statuses, retry exhaustion and immediate exit after durable ACK.
  • Additional tests cover socket/TLS errors, deadline-bounded retries, safe logging and response size limits.
  • Regenerated the embedded workflow and verified exact source parity with its generator.

Implemented and reviewed with Codex (GPT-6.1).

@zehongye-gaga
zehongye-gaga merged commit 7bf5b46 into main Nov 11, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant