← Back to Pull requests

fix(llm): reject registrations with colliding cache paths #6005

Closed
unknown closed this pull request without merging on Nov 04, 2026 15:52 UTC
View on GitHub
unknown unknown commented on Nov 03, 2026 21:46 UTC
Author

What happens

At 47467ffa, custom qwen2_5-instruct and built-in qwen2.5-instruct can register together but use the same cache directory. At f08f7e9e, custom Qwen2_5-instruct still collides on a filesystem that ignores case.

Windows marker-file probes showed each selection returning the other's cached files in both creation orders. The custom-first probe used a directory junction; the built-in-first probe used a constructed cache directory. No model weights were loaded.

Cause

Registration compares names literally, while cache paths replace . with _. Case-insensitive lookup can make differently cased paths identify the same directory.

Change

Add an LLM cache-identity check under the registration lock, before insertion or persistence. Compare computed cache paths against built-in and registered families; conflicts raise ValueError, surfaced as HTTP 400.

Inspect existing entries inside the cache parent first. When they cannot establish case behavior, create the parent if needed and use a unique temporary directory inside it, removing the probe afterward. Case-only variants remain distinct on a case-sensitive cache directory after cache cleanup when probing succeeds. If existing entries and the temporary probe cannot establish case behavior, both new registrations and startup loading conservatively use casefolded comparison, which can still reject a legitimate case-only pair. Unicode normalization is outside this change.

Within-family hub sharing remains allowed. Conflicting persisted definitions are skipped with a warning and their JSON files remain. A legacy collision can prevent worker handoff. Existing shared cache contents are not repaired.

The registration tests use their own registry, family list and engine tables. A real-filesystem regression persists the Qwen case-only pair and reloads it after emptying or removing v2; it skips only when directory creation establishes that the cache parent ignores case. Probe tests cover empty and missing parents, cleanup, and failures.

Tests

I ran f6b201a7 on Windows with Python 3.14.6 and 3.10.20, PYTHONPATH=., HF_HUB_OFFLINE=1, TRANSFORMERS_OFFLINE=1 and a temporary XINFERENCE_HOME:

python -m pytest -q -p no:cacheprovider -o addopts="" xinference/model/llm/tests/test_llm_family.py -k "share_the_cache_directory_of_a_builtin or its_own_cache_directory or cache_directories_coincide or startup_skips_a_persisted or twin_of_a_builtin or up_to_case or case_probe or before_the_fixture or cache_cleanup or unknown_cache_case"

With a persisted my-qwen loaded at startup, both versions reported 24 passed, 2 skipped, 154 deselected; the two skips are the cache-cleanup reloads, because an ordinary NTFS directory ignores case. With --basetemp in a directory marked case sensitive (fsutil file setCaseSensitiveInfo), the same selection gave 26 passed on both versions; there, with the production code of 41d68c7a, both cache-cleanup reloads fail (13 of the 16 cleanup and probe tests fail). With the previous fixture, the persisted my-qwen made one test fail with the duplicate-name error.

The whole family file gave 6 failed, 169 passed, 5 skipped on each version, versus 6 failed, 152 passed, 3 skipped at f08f7e9e; the same six tests fail for offline downloads, unavailable symlinks or the missing llama.cpp engine. Targeted pre-commit checks passed.

On Ubuntu 24.04.5 with Python 3.12.3 and 3.10.22, the changed test file gave 177 passed, 2 skipped (175 passed with the CI pin Transformers 4.57.6), with the cache-cleanup reloads running; with the production code of 41d68c7a they fail because startup leaves the custom model unregistered. The other failures (test_query_engine_general, plus test_engine_discovery_paths_agree_on_draft_support on the pin) also fail at 41d68c7a. I could not run it on macOS.

AI disclosure: this was prepared with AI assistance (Claude Opus 5.5 and Claude Sonnet 5.5).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JfvcPZyKcKQUG9fQGYfRMw

Diff: 518 lines (+388 / -130) across 6 files Reviewer: Jackmeson1 Review duration: 1086m
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.53) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.53 · 518 lines diff across 6 files
0.53
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.374
Shallow Review Depth shallow_review_depth
0.289
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #6005"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 52.7% (MEDIUM) · Higher = larger blast radius
52.7%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 20.8% · Safe to merge
20.8%