Skip to content

Expose AiCatalogItem soft deleted fields

What does this MR do and why?

Expose AiCatalogItem soft-deleted fields in GraphQL for AI Catalog items.

The fields are Experimental are so have not been released, and so no changelog is required.

References

How to set up and validate locally

Enable the global_ai_catalog flag

Patch your local to allow any project to have AI Catalog items

--- a/ee/app/models/ee/project.rb
+++ b/ee/app/models/ee/project.rb
@@ -624,6 +624,7 @@ def suggested_reviewers_available?
      end

      def ai_catalog_available?
+        return true
      ::Gitlab::Llm::StageCheck.available?(self, :ai_catalog)
      end
      strong_memoize_attr :ai_catalog_available?

On your rails console, create 2 AI Catalog items; one soft-deleted and one not:

project = Project.last
FactoryBot.create(:ai_catalog_agent, project: project)
FactoryBot.create(:ai_catalog_agent, project: project, deleted_at: Time.now)

In http://gdk.test:3000/-/graphql-explorer, query for the item, replacing the <ID> with the ID of each of the items you created:

{
  aiCatalogItem(id: "gid://gitlab/Ai::Catalog::Item/<ID>", showSoftDeleted: true) {
    id
    softDeletedAt
    softDeleted
  }
}

For the soft-deleted item, you should see a response similar to:

{
  "data": {
    "aiCatalogItem": {
      "id": "gid://gitlab/Ai::Catalog::Item/203",
      "softDeletedAt": "2025-10-20T02:20:03Z",
      "softDeleted": true
    }
  },
  "correlationId": "01K7ZPXB276QFGPMFAHRKGBZHV"
}

For the non soft-deleted item, you should see a response similar to:

{
  "data": {
    "aiCatalogItem": {
      "id": "gid://gitlab/Ai::Catalog::Item/202",
      "softDeletedAt": null,
      "softDeleted": false
    }
  },
  "correlationId": "01K7ZPZTKR04ABKTG24A5QMMMD"
}

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.

Related to #575127

Edited by Luke Duncalfe

Merge request reports

Loading