Update last_queried_at during Semantic Code Search
What does this MR do and why?
As part of &19655, we are introducing an auto-deletion process that will delete the Code Embeddings of a project if it hasn't been used/search in a while.
To achieve this, we need to:
- IN THIS MR: Update the
Ai::ActiveContext::Code::Repository#last_queried_atwhenever a semantic code search is performed on its associated project - Issues #577332 (closed) & #577333: Perform the deletion of Code Embeddings after a certain time has passed since
last_queried_at
References
Related issue: [Code Embeddings Query] Set last_queried_at (#576637 - closed)
Screenshots or screen recordings
Screen recording show semantic_code_search execution changes the Ai::ActiveContext::Code::Repository#last_queried_at timestamp.
Screen_Recording_2025-10-27_at_19.29.19
How to set up and validate locally
-
Setup MCP server on your GDK
-
Enable the
code_snippet_search_graphqlapiFeature Flag -
With your preferred MCP client (you can use MCP Inspector), perform a
semantic_code_searchon a project with Code Embeddings -
Verify that the
last_queried_atof that project'sAi::ActiveContext::Code::Repositoryrecord has been updated, ie:project_id = # ID of project you set up from Step 2 ac_repository = Ai::ActiveContext::Code::Repository.find_by(project_id: project_id) ac_repository.last_queried_at
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 #576637 (closed)