This change rolls in nearly all existing local PLG context into the ContextRetriever class, which will be the new focal point for retrieving unified context from both client and server. The new context retrieval is enabled with the cody.internal.serverSideContext flag.
The context incorporated in this change includes:
Explicit symbol and file mentions
OpenCtx context
"Priority" context, such as the README when the "include README" heuristic is triggered
Indexed symf results (this is used as a fallback when server-side context does not exist for a given repository)
The context that has not been incorporated by this change:
Local embeddings
The new context construction code path and the legacy context have been factored cleanly into legacyComputeContext and _computeContext methods within ChatController to make it clear what the delineation is.
Following this change, we should be able to remove the legacyComputeContext path altogether (but we should do more testing here). After that, the final step to unifying context fetching is to roll in the enterprise context fetching into ContextRetriever.
Here is a video showing how to enable the new context fetching path, along with how to compare context fetched from different sources in the UI:
As you can see from the video, there are some behavior changes and regressions in the new context fetching, which I'll look into following this PR. This PR does not change any production behavior because everything is gated behind the cody.internal.serverSideContext flag.
Test plan
Check out the branch and enable the settings (cody.internal.serverSideContext and cody.internal.showContextAlternatives).
Use the chat as normal, as shown in the video.
Verify that behavior is unchanged if those flags are false.
Implements part of https://linear.app/sourcegraph/issue/AI-160/unify-context-fetching-code-paths
This change rolls in nearly all existing local PLG context into the
ContextRetriever
class, which will be the new focal point for retrieving unified context from both client and server. The new context retrieval is enabled with thecody.internal.serverSideContext
flag.The context incorporated in this change includes:
The context that has not been incorporated by this change:
The new context construction code path and the legacy context have been factored cleanly into
legacyComputeContext
and_computeContext
methods withinChatController
to make it clear what the delineation is.Following this change, we should be able to remove the
legacyComputeContext
path altogether (but we should do more testing here). After that, the final step to unifying context fetching is to roll in the enterprise context fetching intoContextRetriever
.Here is a video showing how to enable the new context fetching path, along with how to compare context fetched from different sources in the UI:
https://github.com/user-attachments/assets/5cfa9468-9fa7-4ccb-8bf8-5ea3ebc5459e
As you can see from the video, there are some behavior changes and regressions in the new context fetching, which I'll look into following this PR. This PR does not change any production behavior because everything is gated behind the
cody.internal.serverSideContext
flag.Test plan
cody.internal.serverSideContext
andcody.internal.showContextAlternatives
).