Skip to content

Migrations: filters not assigned to retrieval tool #38

@MicaPerdomo

Description

@MicaPerdomo

Description

When running migrations that include BaseMetadataConfig classes in a BaseRetrieval.filters list, the CreateRetrieval operation serializes the filter references as Python class repr strings (e.g., "<class 'data.knowledgebase.metadata.CategoryMetadata'>") in the migration state. During _sync_content_with_api(), the _set_if_defined("filters") call (line ~354 in migrate.py) copies this raw value into the API payload without resolving it to metadata config IDs.

As a result:

  • The MetadataConfig is created correctly on the node.
  • The Retrieval is created/updated correctly.
  • But the filters are not assigned to the retrieval tool — they appear as empty [] in the platform.

Steps to Reproduce

  1. Define a BaseMetadataConfig subclass (e.g., CategoryMetadata).
  2. Reference it in BaseRetrieval.filters = [CategoryMetadata].
  3. Run manage.py migrate data and manage.py migrate agents.
  4. Check the retrieval tool in the platform — filters are empty.

Expected Behavior

The migration should resolve the BaseMetadataConfig class references to their remote metadata config IDs and assign them to the retrieval tool via the API.

Actual Behavior

The filters field in the state contains class repr strings that are passed as-is to the API, which either ignores them or fails silently. The retrieval tool ends up with filters: [].

Affected Examples

  • examples/search-with-filters (genre, language, decade filters on MovieSearch)
  • examples/support-escalation (category filter on HelpDeskSearch)

Environment

  • cogsol-framework 0.2.1
  • Python 3.9

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