Issues / #1072

#1072 Vision: >64 unique images can evict .sve files still referenced by the current request

closed · @jinyu0 · 2 comentarios · En GitHub

Server & APIModels & quantsWindows

Descripción

### Summary

A vision request containing more than 64 unique images can fail with `FileNotFoundError`.

`Vision.encode()` evicts and deletes the oldest cached `.sve` file once the cache exceeds 64 entries, but `Service.prepare()` may still hold that file path in the current request's `encoded` list. `write_temporary()` later tries to read the deleted file.

### Reproduction

1. Start Strata with vision enabled.
2. Send a request whose conversation history contains more than 64 unique images (for example, a long image-tagging session in an agent that resends conversation history).
3. Around the 65th+ unique image, the request fails.

### Expected

The request should succeed, or return a clear validation error if more than 64 images per request are intentionally unsupported.

### Actual

The server raises:

```text
FileNotFoundError: [Errno 2] No such file or directory:
'C:\\Users\\...\\AppData\\Local\\Temp\\strata-vision-...\\....sve'

  File "serve/server.py", line 954, in prepare
    f.write(path.read_bytes())
```

The prompt was still below the configured context limit when this occurred.

### Environment

- Windows 11
- Python 3.14
- Vision enabled
- Qwen3.8-Flash-Next
- Context: 131072

### Likely cause

The current cache eviction logic removes the oldest file immediately:

```python
self.cache[key] = (out, int(line.split()[1]))
if len(self.cache) > 64:
    old = next(iter(self.cache))
    self.cache.pop(old)[0].unlink(missing_ok=True)
```

while the current request later combines all paths returned by `Vision.encode()`.

It looks like active-request embeddings need to remain alive until the combined request embedding has been written, with cache eviction happening afterwards (or active entries being pinned).

En el sitio

Enlaces a install, modelos, releases.