Skip to content

🐝 Resume interrupted AI OCR reviews and retry Ollama connections - #15

Merged
lindsey-pony[bot] merged 2 commits into
mainfrom
general-firefly
Nov 28, 2026
Merged

lindsey-pony[bot] merged 2 commits into
mainfrom
general-firefly

Conversation

@kefania-pony

@kefania-pony kefania-pony Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Long AI-reviewed OCR runs can lose completed work when the local Ollama connection drops. This change adds an opt-in checkpoint to the enhancement pipeline and bounded retries for transient request failures.

  • Extend the combined OCR and AI-review pipeline introduced in 6eb36a4 so that setting PDF_MAGIC_REVIEW_CHECKPOINT with --ai-review preserves the intermediate OCR PDF and page-review JSONL. Restarting with the same checkpoint skips OCR and completed page reviews, while rebuilding the tagging output.
  • Flush and synchronize each completed review to disk, discard an unterminated final JSONL record on resume, and report previously completed progress.
  • Retry dropped connections, timeouts, incomplete HTTP reads, and HTTP 502, 503, or 504 after 2, 5, 15, and 30 seconds. Other HTTP errors fail immediately, including a missing model (HTTP 404, as documented in Ollama's API error reference). Exhausted retries produce a page-specific error without a Python traceback.
  • Check the tagged PDF's structure and page count before moving it to the requested output path, export the checkpointed review report alongside it, and ensure a text sidecar exists even when no non-artifact blocks are recognized.
  • Add regression tests for connection recovery, non-retryable model errors, interrupted JSONL writes, and restarting a failed review without repeating OCR or modifying the source PDF.

Checkpoint reuse assumes the same input and review configuration; the Enhancer does not validate their identity against saved checkpoint files.

@lindsey-pony
lindsey-pony Bot merged commit 8469393 into main Nov 28, 2026
1 check passed
@lindsey-pony
lindsey-pony Bot deleted the general-firefly branch November 28, 2026 11:30
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