feat: Order ai catalog items based on catalog priority
What does this MR do and why?
This MR improves the discoverability of AI catalog items by implementing a three-tier priority-based sorting system. Previously, AI catalog items were ordered with only two priorities: foundational items first, then all remaining items.
New sorting order:
-
GitLab foundational agents & External Agent - GitLab-maintained agents like Planner and Security Analyst. External agents like
Claude Agent by GitLabandCodex Agent by GitLab - GitLab foundational flows - Built-in flows maintained by GitLab
- User's authorized project items - Agents/flows created in projects the user has access to
- All other public items - Community-created content
This change is controlled by a feature flag (ai_catalog_priority_sort) that is enabled by default.
Impact:
- Users can now easily discover both GitLab's trusted foundational items and their organization's custom agents/flows
- Applies automatically to both Explore-level catalog pages and Group/Project > Automate pages
Issue #587379
References
Screenshots or screen recordings
User having access of below 3 projects (expand this), so these project's items will be visible in priority.
| Explore Level | Group Level | Project Level |
|---|---|---|
How to set up and validate locally
- Enable the feature flag:
Feature.enable(:ai_catalog_priority_sort) - Navigate to the AI Catalog:
/explore/ai-catalog/agentsor/explore/ai-catalog/flows - Verify the sorting order:
- Foundational agents/flows appear first
- Items from your authorised projects appear second
- Other public items appear last
- Test at group & project level: Navigate to a project's Automate page and verify the same sorting applies
- Verify above behaviour on SaaS and SM mode, with toggling feature flag
ONandOFF
Note: For foundational agent we are not creating item_consumer records, so they are not visible on Group/Project > Automate pages
Database review
- Query plan for explore level page - https://postgres.ai/console/gitlab/gitlab-production-main/sessions/48506/commands/145729
- Query plan for project/group level page - https://console.postgres.ai/gitlab/gitlab-production-main/sessions/48506/commands/145732
Discussion about different approach - !222430 (merged)
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Jaydip Pansuriya