Pull requests / #3118
#3118 fix(serve): a cached image whose .sve was deleted is encoded again; a 500 instead of a dropped connection
open · @kai-chop · 0 コメント · GitHub で見る
Setup & installServer & APINVIDIA / CUDAModels & quantsWindows
本文
## Title Issue: none filed ## Summary A cached image whose `.sve` file 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 only `ECONNRESET` and retries forever. Two causes, both still on `main`: 1. `Vision.encode` treats a key in `self.cache` as a hit without checking that its file still exists, so the engine is handed a missing file. 2. The resulting `FileNotFoundError` is an `OSError`, and `_post`'s `except OSError` treats every `OSError` as 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`: only `ConnectionError` / `TimeoutError` are treated as a client that left (as before). `BadBody` is re-raised to `do_POST` (400 / 413, as before). Any other exception raised before the answer began is a `500` that 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 unexpected `OSError` and another exception are a 500; `ConnectionResetError`, `BadBody` and an answer already begun are still re-raised; `ValueError` keeps its 400. Two tests fail without the change. ## Extra Notes - Measured on Windows 11, RTX (CUDA), Qwen3.8-Flash-Next IQ3_S, installed from v0.1.43.1: with the `.sve` of 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 `.sve` is written again; requests without pictures and with other pictures are unchanged, and a malformed body is still a 400. - On v0.1.43.1 the full `serve` suite passes with the change (733 tests, OK, 12 skipped). On this branch (current `main`) I could only run it in a checkout of `serve/` without the native modules: 360 errors with and without the change, the same set, so none comes from this change. - I did not find what deleted the file. Here the cache dir was under `%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](https://claude.com/claude-code)
関連リンク
インストール・モデル・リリースへの站内リンク。