Skip to content

[Code Embeddings Query] Add eligibility check for ad-hoc indexing

Context

From !211257 (merged):

When triggering the ad-hoc indexing, the Ai::ActiveContext::Queries::Code class does not check if the given project is actually eligible for Code Embeddings indexing.

So it can mistakenly return a message with "initial indexing has been started, try again in a few minutes" even if the Code Embeddings indexing of that project was actually not kicked off.

Proposal

Do an upfront eligibility check in Ai::ActiveContext::Queries::Code before calling the AdHocIndexingWorker. Use the eligibility check in the worker.

Edited by Pam Artiaga