Skip to content

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

Description

@AWUQAQ

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: 1860d85

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions