Skip to content

[Code Embeddings Query] Set last_queried_at

Context

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 set a last_queried_at to the Ai::ActiveContext::Code::Repository record, then perform the deletion of Code Embeddings after a certain time has passed since the last_queried_at.

Tasks:

  1. Introduce a last_queried_at field to the Ai::ActiveContext::Code::Repository record (issue: #576631 (closed))
  2. In Ai::ActiveContext::Queries::Code, set the last_queried_at of the given project's Ai::ActiveContext::Code::Repository record - THIS ISSUE
  3. Create a worker that checks the last_queried_at, and start the deletion of those that haven't been used/search through in a while (issue TBA)

Proposal

In Ai::ActiveContext::Queries::Code, set the last_queried_at of the given project's Ai::ActiveContext::Code::Repository record.

IMPORTANT: this issue is only concerned about setting the last_queried_at step of the auto-deletion process. Please refer to the other linked issues for the other steps.

Note: There is a different issue [SemanticCodeSearch MCP tool] Handle projects w... (#576632 - closed) that handles the scenario where the Ai::ActiveContext::Code::Repository doesn't exist yet.

Edited by Pam Artiaga