mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #3118] [CLOSED] fix(serve): a cached image whose .sve was deleted is encoded again; a 500 instead of a dropped connection #4462
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4462
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3118
Author: @kai-chop
Created: 10/19/2026
Status: ❌ Closed
Base:
main← Head:fix-vision-cache-500📝 Commits (1)
a66e941fix(serve): a cached image whose .sve was deleted is encoded again; a 500 instead of a dropped connection📊 Changes
3 files changed (+142 additions, -1 deletions)
View changed files
📝
serve/server.py(+16 -1)➕
serve/test_internal_error_500.py(+71 -0)➕
serve/test_vision_cache_missing.py(+55 -0)📄 Description
Title
Issue: none filed
Summary
A cached image whose
.svefile has been deleted from the encoder's temp directory (%TEMP%\strata-vision-*; something cleaned it while the server ran) makes every request that carries that picture end with a dropped connection and no answer. Clients that resend the whole history (opencode, Claude Code) then fail every later request of the conversation; opencode reports onlyECONNRESETand retries forever.Two causes, both still on
main:Vision.encodetreats a key inself.cacheas a hit without checking that its file still exists, so the engine is handed a missing file.FileNotFoundErroris anOSError, and_post'sexcept OSErrortreats everyOSErroras a client that left: it re-raises, nothing is answered, and the cause is never visible to the client.What changed
serve/server.py,Vision.encode: a cache entry whose file is gone is dropped and the image is encoded again.serve/server.py,_post: onlyConnectionError/TimeoutErrorare treated as a client that left (as before).BadBodyis re-raised todo_POST(400 / 413, as before). Any other exception raised before the answer began is a500that names it (internal server error (FileNotFoundError: ...)), with the traceback in the log, in the same shape as the existing 400 for a malformed body; an answer already begun is not replaced.serve/test_vision_cache_missing.py: a hit with the file present is still a hit; a deleted file is encoded again. Fails without the change.serve/test_internal_error_500.py: an unexpectedOSErrorand another exception are a 500;ConnectionResetError,BadBodyand an answer already begun are still re-raised;ValueErrorkeeps its 400. Two tests fail without the change.Extra Notes
.sveof one RGBA PNG (832x1248) deleted, a one-picture request dropped the connection in 0.02 s; the same bytes plus one trailing byte (another cache key) answered 200. With the change, the same request after deleting the file answers 200 and the.sveis written again; requests without pictures and with other pictures are unchanged, and a malformed body is still a 400.servesuite passes with the change (733 tests, OK, 12 skipped). On this branch (currentmain) I could only run it in a checkout ofserve/without the native modules: 360 errors with and without the change, the same set, so none comes from this change.%TEMP%(strata-vision-kp5r7rqe), which Windows Storage Sense and cleanup tools may empty while a server runs for days (a guess, not verified).🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.