sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.53k stars 261 forks source link

refactor context-fetching #5100

Closed sqs closed 1 month ago

sqs commented 1 month ago

Now, the context-fetching code looks at the mentions to determine which repo(s) to search in. For example, if there is an @-mention of a repository, then that repository is searched. These special @-mentions are called "corpus" mentions because they need to be expanded specially (unlike file @-mentions that refer to just a single document).

This is better than the previous way, which:

  1. still used the "enhanced context" concept (a coarse boolean) instead of reading the context @-mentions (such as @repository) to determine the behavior
  2. was built in a way that made support for multiple workspaces hard

There is no (intended or known) behavior change. Note that none of the agent snapshot tests needed changing.

Test plan

Test context-fetching on PLG and enterprise. Ensure that PLG uses symf and embeddings, and enterprise uses remote context search.