Add Duo User Rules Context support
What does this MR do and why?
This is a draft until the cloud connector gets released and updated in this project.
This MR adds another "Duo Context" category. Now you can include open tabs, dependencies, git information, issues, MRs as reference to your Duo (Agentic) Chat.
This MR adds user_rule. This context will contain custom user rules for how the chat should behave.
See the demo in [Agentic Chat] Create custom rules - first iter... (#550743 - closed) to understand the feature.
References
- Issue: #550743 (closed)
Screenshots or screen recordings
The user-facing logic is implemented in the VS Code Extension & Language Server.
How to set up and validate locally
The cloud-connector has not been released yet, so there is a bit of extra effort to make this work.
The full setup end-to-end (not necessary for review) is described here gitlab-org/editor-extensions/gitlab-lsp!1878 (merged)
Cloud Connector
- Check out locally the cloud connector
- The
mainbranch already contains the Unit Primitives for this new feature
gdk/gitlab
-
In
gdk/gitlab, apply this patch to connect the cloud-connectorgdk cloud connector local setup
diff --git i/Gemfile w/Gemfile index 465e25298afb0..bff5f52d10e9f 100644 --- i/Gemfile +++ w/Gemfile @@ -758,4 +758,4 @@ gem 'paper_trail', '~> 16.0', feature_category: :shared gem "i18n_data", "~> 0.13.1", feature_category: :system_access -gem "gitlab-cloud-connector", "~> 1.14", require: 'gitlab/cloud_connector', feature_category: :plan_provisioning +gem "gitlab-cloud-connector", "~> 1.14", require: 'gitlab/cloud_connector', feature_category: :plan_provisioning, path: '/Users/tomas/workspace/gl/gitlab-cloud-connector/src/ruby' diff --git i/config/application.rb w/config/application.rb index 3d8b4af3c3305..53c1788d784dd 100644 --- i/config/application.rb +++ w/config/application.rb @@ -20,6 +20,7 @@ module Gitlab class Application < Rails::Application config.load_defaults 7.0 + CloudConnector::Configuration.config_dir = '/Users/tomas/workspace/gl/gitlab-cloud-connector/config' # This section contains configuration from Rails upgrades to override the new defaults so that we # keep existing behavior. -
run
bundle install -
restart the GDK
-
enable the feature flag
echo "Feature.enable(:duo_include_context_user_rule)" | rails c -
run the following GraphQL query in the explorer http://gdk.test:3000/-/graphql-explorer
query getDuoAvailableFeatures { currentUser { duoChatAvailableFeatures } } -
and see the response, important is that
include_user_rule_contextis present{ "data": { "currentUser": { "duoChatAvailableFeatures": [ "include_file_context", "include_snippet_context", "include_merge_request_context", "include_issue_context", "include_dependency_context", "include_local_git_context", "include_user_rule_context", "include_repository_context" ] } } }
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.