Skip to content

Images whose caption failed are described on the next pass - #368

Merged
mattshax merged 1 commit into
mainfrom
caption-retry
Oct 2, 2026
Merged

mattshax merged 1 commit into
mainfrom
caption-retry

Conversation

@mattshax

@mattshax mattshax commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Images whose caption failed are described on the next pass (#368)

An uploaded image got no text in the index and never would. The configured vision model refused the caption request (403, in 0.2 s), OCR correctly found no text in a photograph, and the indexer cached the empty result: images cache even when empty, so a picture with nothing to transcribe is not re-sent to the vision model on every pass. That rule could not tell an image with nothing to say from one that was never described, so the empty entry outlived the failure, including after the vision model setting was changed to one that works. The failure itself was invisible: enrich.py reports it on stderr, which the server discarded whenever the pass as a whole succeeded.

Retry. caption_image now returns None when the request fails and '' when captioning is off or the image is too large. A failed caption is not cached, so the next pass asks again; the OCR text, if any, is still indexed for that pass. While a vision model is configured, an empty cached image result is treated as missing and re-extracted: a successful caption is never empty, so such an entry was written by a failed request or before captioning was on. With captioning off, empty entries stand as before. warm_image_cache.py follows the same rules.

Visible. Lines from the indexer's stderr that report a failure (caption failed ..., extract failed ...) go to the server log through the sweep's logger, prefixed index:, even when the pass succeeds.

Tested with the real enrich.py against a stand-in gateway in the test process: a refused caption leaves no cache entry and the next pass, with the gateway answering, caches the description; a good entry is reused without a request; an empty entry is retried with a model configured and kept with none. All server and web tests pass.

@mattshax
mattshax merged commit b7208a1 into main Oct 2, 2026
2 checks passed
@mattshax
mattshax deleted the caption-retry branch October 2, 2026 18:35
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