modelscope / modelscope/ms-agent
Skill search returns stale results after all skills are disabled or removed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 521
- Avg merge
- 1d
- Merged PRs (30d)
- 36
Description
Description
After a search populates the skill index, disabling or removing all
skills does not clear the index. Subsequent searches still return
previously indexed skill IDs.
Steps to reproduce
- Create a SkillCatalog with enabled skills.
- Create a SkillSearchEngine using the BM25 backend.
- Search for a term matching an enabled skill.
- Disable or remove every skill in the catalog.
- Run the same search again.
Expected behavior
The search returns an empty list because no enabled skills remain.
Actual behavior
The search returns stale results from the previous index.
Environment
- OS: Windows
- Python: 3.12
- Commit: 1860d85a23dc507c9a7bb908bfdb83a04a6eeb18
Investigation
In SkillSearchEngine._ensure_indexed(), an empty document list skips
retriever indexing, but the cache version is still updated. This leaves
the previous index intact.
Resetting the retriever when there are no enabled skill documents
appears to resolve the problem.
I have a local fix and regression tests covering disabling/removing all
skills, clearing hybrid child indexes, and restoring search after skills
are enabled or added again. All 37 tests in test_skill_features.py pass
with the fix.
I would be happy to submit a PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with SkillSearchEngine._ensure_indexed() and inspect how an empty document list affects the BM25 retriever and cache version. Run test_skill_features.py, including the disabling/removal and hybrid child-index cases; done means searches return no results when all skills are gone and work again after skills are enabled or added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100