Research: Additional contexts and Import context

Context

One of our Code Suggestions focus areas is using context to improve the quality of code suggestions. We need to collaborate with groupeditor extensions on how the Imports Context will be implemented and consumed in Code Suggestions.

References and Resources

Related issue: SPIKE - [LS] ImportContextProvider - Resolve EC... (#491745 - closed)

ImportContextProvider epic: Imports Context Provider - (previously DaVinci ... (gitlab-org/editor-extensions&58 - closed)

Expected Output and Outcome

Related questions to answer

  • Define how referenced files will be merged with existing open-tabs context
  • Determine cache invalidation strategy when referenced files change
  • Plan how to handle context size limits when combining open tabs and referenced files
  • Document and prioritize requirements for adding support for additional languages
  • Define any additional monitoring or telemetry that is needed to track latency and quality of requests using this for additional context
  • Decide on fallback behavior if context gathering exceeds latency targets

Actual Output and Outcome

Research/Investigation notes

#503839 (comment 2266892301)

Issues Created

Answered questions

The "related questions to answer" are addressed in #503839 (comment 2266892301) or Imports Context Provider - (previously DaVinci ... (gitlab-org/editor-extensions&58 - closed). Specifically:

Define how referenced files will be merged with existing open-tabs context

The Open Tabs implementation will be refactored to follow the AI Context Management blueprint. Once that is done, the ImportContextProvider implementation would also follow the blueprint.

Determine cache invalidation strategy when referenced files change

This will be addressed in the ImportContextProvider implementation: [LS] - ImportContextProvider (gitlab-org/editor-extensions/gitlab-lsp#697 - closed)

Plan how to handle context size limits when combining open tabs and referenced files

This will be addressed in [LS] - Create a Code Suggestions Pre-Processor ... (gitlab-org/editor-extensions/gitlab-lsp#699 - closed)

Define any additional monitoring or telemetry that is needed to track latency and quality of requests using this for additional context

Additional contexts are already tracked in Code Suggestions requests, with the additional context type (open_tabs|import) already included in the telemetry data.

We don't need to make any changes here.

Document and prioritize requirements for adding support for additional languages

Given the scope of work for introducing the ImportContextProvider, it is best that we focus on the first iteration (ECMAScript imports) before thinking about other languages.

That said, these has issues already captured in Auto Resolved Imports (&15259 - closed)

Decide on fallback behavior if context gathering exceeds latency targets

This is not something we can do now unless we've done the actual spike or implementation for consuming the ImportContextProvider, which is blocked by Imports Context Provider - (previously DaVinci ... (gitlab-org/editor-extensions&58 - closed) (see #503839 (comment 2288499622) for further details)

Edited by Pam Artiaga