Repository navigation
fix: delete a model without stopping the AI server - #3105
Merged
Merged
Conversation
Deleting a model stopped the AI worker's server on the UI thread so it would let go of the model's files. With a request running, that froze the window for up to 10 s, and every other loaded model had to load again. The worker now unloads the model on its own thread, after the running request, and the files are deleted once it reports back. The server and its other models stay loaded. With release gone, only the worker thread touches its client, so the lock and the request-id bookkeeping that guarded it go too. A delete error now reaches the models dialog through ModelManager.remove_failed.
The worker unloads a model, then the UI deletes its files. A request made in between could load the model again from files about to go. Requests for the model now fail until the files are deleted.
A delete waiting on a running request relied on the worker thread's report, which comes after the app quits, so the files stayed. Quitting now deletes them at once; the thread's late report deletes nothing.
While a delete waited on a running request, the model still counted as downloaded, so it could be selected again and then fail. It now shows as Deleting… and cannot be selected or downloaded until its files are deleted.
Owner
Author
recommend-merge
Windows locked-file behavior was not verified; the PR documents possible deletion failure during shutdown. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
release, the worker's lock and its request-id bookkeeping are gone: only the worker thread touches its client now.ModelManager.remove_failed.Evidence
After:
test_unload_waits_for_the_running_request_and_keeps_the_serverchecks that the unload waits for the running request, fails queued and new requests for the model, and keeps the same client.test_shutdown_deletes_a_model_waiting_on_the_running_requestand thedeletingstate check intest_existing_files_count_as_downloaded_until_deletedcover the other two cases.Merge Danger
Door: two-way
Blast Radius: small
It touches model deletion and the AI worker's shutdown.
Codex review, three rounds, all fixed:
Known limits: