Repository navigation
fix(decision): restore custom model cache versions after restart - #6313
Jackmeson1 wants to merge 2 commits into
Conversation
Include persisted custom Decision families in the startup version inventory so cache listing and removal work after a restart. Verify the cache APIs across a local restart alongside a built-in Decision control. Signed-off-by: Jackmeson1 <130693642+Jackmeson1@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfvcPYCd12wEedB3EKJ39R
qinxuye
left a comment
There was a problem hiding this comment.
I found one restart regression involving models that share a name across types. The inline comment includes the HTTP reproduction.
| model_name: [spec.to_version_info() for spec in families[0].model_specs] | ||
| for model_name, families in BUILTIN_DECISION_MODELS.items() | ||
| } | ||
| for family in registry.get_custom_models(): |
There was a problem hiding this comment.
[P2] Preserve cached versions for models that share a name across types
Decision registration checks names within its own model type, so a persisted Decision model can share a name with an existing embedding model. The startup inventory in core/cache_metadata.py adds Decision after embedding and uses dict.update() keyed by model name. Adding the custom Decision entry here replaces the embedding version list.
I reproduced this through the local HTTP APIs with a custom Decision model named bge-small-en-v1.5. GET /v1/cache/models?model_name=bge-small-en-v1.5 lists both types before restart. After restart, the base still lists the embedding cache. This commit lists only the Decision cache even though the embedding checkpoint is still on disk.
Please merge version lists for shared names when building the startup inventory, and cover a restart where both model types keep their cache entries.
There was a problem hiding this comment.
I updated startup to merge version lists for model types that share a name. The restart test uses bge-small-en-v1.5, checks the paths for both Decision versions and the embedding, then deletes both Decision caches and verifies the embedding checkpoint is still listed and on disk. I also covered worker-specific registrations so an image reported by one worker can’t relabel another worker’s cached reranker. Merging the lists alone let the tracker, which matched worker reports by version ID only, attach one type's cache path to another type with the same ID, so the tracker now also keys rows by model type. If you'd rather review that part separately, I can split it into its own PR.
Merge startup versions in provider order and keep each shared version ID once. Cover shared embedding and Decision caches across restart and removal. Signed-off-by: Jackmeson1 <130693642+Jackmeson1@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JfvcPYCd12wEedB3EKJ39R
qinxuye
left a comment
There was a problem hiding this comment.
The restart regression now keeps both model types in the cache inventory. The 52 focused tests and pre-commit passed on 6c78a579. The remaining issues are type isolation in version queries and unregistration, and making the all-worker delete honor the targets it checked.
| ): | ||
| result.update(tag_model_type(get_versions(), model_type)) | ||
| for name, versions in tag_model_type(get_versions(), model_type).items(): | ||
| result.setdefault(name, []).extend(versions) |
There was a problem hiding this comment.
[P2] Scope version queries and unregistration to the requested model type
The merged inventory now keeps both types under the same name, but SupervisorActor.get_model_versions() ignores model_type, the registration counts still look up by name, and unregister_model_version() removes the entire name bucket. I reproduced this after restarting with a persisted Decision model named bge-small-en-v1.5. Both the Decision and embedding /versions endpoints returned the same three rows. DELETE /v1/model_registrations/decision/bge-small-en-v1.5 then removed the embedding's version and cache listing even though its checkpoint was still on disk. The current restart test filters the response itself, so it misses the mixed /versions result.
Please carry the requested type through lookup, version counts and unregistration, preserving the other type's rows and worker paths. Extend the restart regression to assert that each typed /versions response contains only its own versions, then unregister Decision and assert that the embedding version and cached path remain visible.
| ) | ||
| return ret | ||
| if len(self._worker_address_to_worker) > 1: | ||
| await self._cache_tracker_ref.get_deletion_paths( |
There was a problem hiding this comment.
[P2] Delete only the worker targets selected by preflight
get_deletion_paths() returns the checked paths, but the supervisor discards them and asks every worker to resolve the bare version ID again. In a two-worker test of this flow, only worker A's reranker was present at preflight. Worker B reported an image with the same version ID while the supervisor was awaiting A. B then resolved that image as its only local match, so the delete could remove a cache the preflight never saw.
Please keep the selected worker and cache identities from preflight, dispatch only to those workers, and have each worker verify the expected target before removing files or updating the tracker. Add a regression where B reports the colliding image while A is being processed and verify that B's new cache is left alone.
|
@qinxuye, my local A version-only DELETE should remove only files owned exclusively by the caches selected on each worker. Two cases still break that guarantee on a selected worker:
There’s also a separate metadata issue. After unregistering image, a rerank inventory refresh can relabel an older worker’s untyped path as rerank.
I recommend D so the deletion guarantee gets its own review. Which scope would you prefer? |
|
@Jackmeson1 I'd go with D. The reranker/image race is independent of Decision, and it can unlink a checkpoint even when DELETE reports failure. Please land the shared cache fix first and keep support for names shared across model types.
Please link the shared cache PR here so we can review it first. |
Fixes #6312
After a restart, persisted custom Decision models report their versions again. Existing cache entries appear in the cache API, and DELETE can remove them from disk.
Registration records each custom spec in the cache tracker. At startup, the Decision description provider rebuilt that inventory from built-in families alone. It now includes registered custom families using the same description generator as registration.
The regression registers one family with Hugging Face and ModelScope specs, caches both through HTTP, and restarts the local cluster with the same home. It checks the version IDs, listed paths, on-disk removal and survival of the local source. A built-in
d3-edgecache goes through the same checks.Startup now merges version lists for model types that share a name, preserving provider order and LLM projector rows. The cache tracker matches worker reports by model type and version ID, and checks for ambiguous cache paths before an all-worker deletion starts. The restart regression covers a persisted Decision model named
bge-small-en-v1.5alongside the built-in embedding and verifies that deleting both Decision versions preserves the embedding checkpoint.Validated on Ubuntu 24.04: the changed tests pass on Python 3.12 with Transformers 5.25.1 and 4.57.6 and on Python 3.10 (7 each). With the production file from
2feca74e, the restart regression fails withassert [] == ['dedicated--...'](test_decision_backend.py:154). The consumer tests (35 passed, 1 skipped), pre-commit and mypy over the repository (1,288 files) pass.The follow-up commit
6c78a579(shared names across types) passed on Ubuntu 24.04: pre-commit and mypy over the repository (1,288 files) pass; with the production files from3bf6ec24, the shared-name inventory and differing-worker assertions fail; the changed and consumer test files show no failures beyond those that also fail on3bf6ec24(MLX-only audio engine cases and existing worker tests).AI disclosure: this was prepared with AI assistance (Claude Code with Claude Opus 5.5, and OpenAI Codex with GPT-6.2).
🤖 Generated with Claude Code