From 3c626cdc96ed0897fc3f858d7746c2ecc2c99b38 Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sun, 11 Oct 2026 20:50:57 +0200 Subject: [PATCH] A model removed from the catalog is no longer wanted Removed and added again to give it a licence, qwen3-vl-8b came back loading by itself: its name was still on the wanted list from before. A model that leaves the catalog leaves the list too. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/control/reconciler/reconciler.go | 7 ++++++ .../control/reconciler/reconciler_test.go | 24 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/internal/control/reconciler/reconciler.go b/internal/control/reconciler/reconciler.go index eda1acd..95eea1c 100644 --- a/internal/control/reconciler/reconciler.go +++ b/internal/control/reconciler/reconciler.go @@ -482,6 +482,13 @@ func (r *Reconciler) stopReplicasOfRemovedModels(ctx context.Context) { gone = append(gone, rep) } } + // And whether it was wanted: a model removed and added again, to change + // its entry, came back loading as if just asked for. + for model := range r.wanted { + if _, ok := cat.Resolve(model); !ok { + delete(r.wanted, model) + } + } r.mu.Unlock() for _, rep := range gone { diff --git a/internal/control/reconciler/reconciler_test.go b/internal/control/reconciler/reconciler_test.go index 30898ad..0467828 100644 --- a/internal/control/reconciler/reconciler_test.go +++ b/internal/control/reconciler/reconciler_test.go @@ -1337,6 +1337,30 @@ func TestAModelRemovedWhileRunningIsStopped(t *testing.T) { } } +func TestAnOnDemandModelRemovedAndAddedAgainIsNotLoadedUnasked(t *testing.T) { + // The VLM, removed and added again to give it a licence, came back + // loading on its own: still on the wanted list from before its removal. + h := newHarness(t, testModel(1), gpuNode("1", 4)) + h.r.cat.Store(twoOnDemandModels(t)) + h.r.Want("llama") + h.r.Reconcile(t.Context()) + h.markReady() + + only := mustResolve(t, h, "second") + without, err := catalog.New([]catalog.Model{only}) + if err != nil { + t.Fatal(err) + } + h.r.cat.Store(without) + for range 3 { + h.r.Reconcile(t.Context()) + } + h.r.cat.Store(twoOnDemandModels(t)) + if n := h.r.baseFor(mustResolve(t, h, "llama")); n != 0 { + t.Errorf("added again, it wants %d replicas before anybody asked", n) + } +} + // --- on-demand loading and idle eviction --- func onDemandModel(idle time.Duration) catalog.Model {