Skip to content

fix(sdk): retry cleanly truncated backend streams - #68

Draft
adarshh347 wants to merge 1 commit into
OpenBMB:mainfrom
adarshh347:fix/retry-truncated-backend-streams
Draft

adarshh347 wants to merge 1 commit into
OpenBMB:mainfrom
adarshh347:fix/retry-truncated-backend-streams

Conversation

@adarshh347

Copy link
Copy Markdown
Contributor

Summary

Do not treat clean EOF without a protocol completion marker as successful partial OCR. Raise DialectError so the existing synchronous client retry/deadline policy applies. SSE accepts either DONE or a first-choice finish_reason; NDJSON requires done. Existing response cleanup and callback restart semantics are retained.

Independent of #66 and #67, based directly on main. Those address input deduplication and output naming, not backend stream completeness.

Validation

  • macOS arm64 Python 3.12: PYTHONPATH=sdk python -m pytest sdk/tests/test_backend_streaming.py sdk/tests/test_stream_pages.py sdk/tests/test_http_session_reuse.py -q: 55 passed, 3 optional skips.
  • Regression checks exercise actual collector/client code with controlled response fixtures: partial/empty/keepalive EOF, terminal alternatives, wrong-choice termination, SSE and NDJSON retry/restart, response closure, and retry exhaustion.
  • Initial regressions fail on unchanged source. Independent AI reviewer reran focused tests and cleared the final exhaustion regression.
  • Broader review-environment run excluding uncollectable KIE/seal tests: 532 passed, 11 failed, 12 skipped; unchanged baseline had 519 passed and the same 11 failures (9 deployment-path assumptions and 2 missing optional cv2). Full suite is not green.
  • git diff --check passes.

Behavior and limits

Retries may repeat inference and increase compute/cost within the existing configured deadline; this is not cancellation of an in-flight server job. A backend that never emits a recognized terminal marker now fails/retries deliberately. Partial callbacks remain provisional and restart=True marks replacement text. No live paid service, GPU/model inference, native async transport or broader parser validation is claimed.

Implementation, tests and independent review were AI-assisted. Draft for maintainer review.

This branch has not been deployed

No deployments
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