modelscope / modelscope/ms-agent

Skill search returns stale results after all skills are disabled or removed

Open Beginner friendly
#974 0 comments 0 reactions 0 assignees View on GitHub

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
  1. Create a SkillCatalog with enabled skills.
  2. Create a SkillSearchEngine using the BM25 backend.
  3. Search for a term matching an enabled skill.
  4. Disable or remove every skill in the catalog.
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.