mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-28 09:08:54 -04:00
Restoring a snapshot after a failed stop lost the request lifecycle events that happened while the stop was in progress. A request completing during the stop found no tracked request, and the restore then resurrected it, leaving the backend marked busy. A request starting during the stop was overwritten by the restore, so completing an older request marked the backend idle while the new one still ran, allowing an unsafe eviction. An eviction now detaches only the backend identity (model, process, size estimate) from the registry and marks the address as pending. Request state stays live, so callbacks keep updating it during the stop. Idle and busy checks skip pending addresses so they neither re-evict nor wipe that state. When the stop settles, a backend that still runs is registered again; otherwise its leftover request state is cleared. A replacement registered on the address meanwhile is left alone. Regression tests cover a request completing and a request starting inside a failing force stop. The idle and busy failure tests now prove re-tracking through a second stop attempt instead of sampling the registry, which raced with the pending window. Assisted-by: Claude:claude-opus-5.5 go vet golangci-lint Signed-off-by: Hugues CHARBONNIER <hugues.charbonnier@gmail.com>