diff --git a/config/feature_flags/experiment/use_cloud_connector_lb.yml b/config/feature_flags/experiment/use_cloud_connector_lb.yml deleted file mode 100644 index e77c333d214b6d3e4625995f68af900c05f34ab4..0000000000000000000000000000000000000000 --- a/config/feature_flags/experiment/use_cloud_connector_lb.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: use_cloud_connector_lb -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139265 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/435142 -milestone: '16.8' -type: experiment -group: group::cloud connector -default_enabled: false diff --git a/doc/development/ai_features/index.md b/doc/development/ai_features/index.md index 9a564d33f4e9f432148e019792679b2b6b1e2431..d7ba33f01ba8011f8a189fcf4aed088dbc51a388 100644 --- a/doc/development/ai_features/index.md +++ b/doc/development/ai_features/index.md @@ -218,8 +218,8 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- 1. Export these environment variables in the same terminal session with `gdk start`: ```shell - export CODE_SUGGESTIONS_BASE_URL=http://0.0.0.0:5052 # URL to the local AI Gateway instance - export LLM_DEBUG=1 # Enable debug logging + export AI_GATEWAY_URL=http://0.0.0.0:5052 # URL to the local AI Gateway instance + export LLM_DEBUG=1 # Enable debug logging ``` Alternatively, you can create an `env.runit` file in the root of your GDK with the above snippet. diff --git a/doc/development/code_suggestions/index.md b/doc/development/code_suggestions/index.md index d07069386ef6a510fc98c0711dc031cd140a8f3d..5aded77191717c910a84b2c3fd29916a7adc9ff8 100644 --- a/doc/development/code_suggestions/index.md +++ b/doc/development/code_suggestions/index.md @@ -28,7 +28,7 @@ This should enable everyone to see locally any change in an IDE being sent to th 1. In your terminal, navigate to a `gitlab` inside your `gitlab-development-kit` directory 1. Run `bundle exec rails c` to start a Rails console 1. Call `Feature.enable(:code_suggestions_tokens_api)` from the console - 1. Run the GDK with ```export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052``` + 1. Run the GDK with ```export AI_GATEWAY_URL=http://localhost:5052``` 1. [Setup AI Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally) 1. Build tree sitter libraries ```poetry run scripts/build-tree-sitter-lib.py``` 1. Extra .env changes for all debugging insights @@ -48,7 +48,7 @@ with the deployed staging AI Gateway. To do this: ```shell export GITLAB_LICENSE_MODE=test export CUSTOMER_PORTAL_URL=https://customers.staging.gitlab.com - export CODE_SUGGESTIONS_BASE_URL=https://codesuggestions.staging.gitlab.com + export AI_GATEWAY_URL=https://cloud.staging.gitlab.com/ai ``` 1. Restart the GDK. diff --git a/doc/user/project/repository/code_suggestions/troubleshooting.md b/doc/user/project/repository/code_suggestions/troubleshooting.md index 29477af5ae0b59822463fbba2924d76d6c2acbab..a28c82a58dcbcd9d52ebd7f4a99acc7bcfdea8b3 100644 --- a/doc/user/project/repository/code_suggestions/troubleshooting.md +++ b/doc/user/project/repository/code_suggestions/troubleshooting.md @@ -41,7 +41,7 @@ If the settings are enabled, but Code Suggestions are still not displayed, try t ```shell 2023-07-14T17:29:00:763 [debug]: Disabling code completion 2023-07-14T17:29:01:802 [debug]: Enabling code completion -2023-07-14T17:29:01:802 [debug]: AI Assist: Using server: https://codesuggestions.gitlab.com/v2/completions +2023-07-14T17:29:01:802 [debug]: AI Assist: Using server: https://cloud.gitlab.com/ai/v2/code/completions ``` ### Code Suggestions not displayed in Microsoft Visual Studio diff --git a/ee/lib/gitlab/ai_gateway.rb b/ee/lib/gitlab/ai_gateway.rb index 29ccb856bcdc5d02f5da17b5bd53b2e818934d67..7fea31d504cf9df60f9d35b24493c5af9a034442 100644 --- a/ee/lib/gitlab/ai_gateway.rb +++ b/ee/lib/gitlab/ai_gateway.rb @@ -2,19 +2,8 @@ module Gitlab module AiGateway - # Going forward, we should route this through cloud.gitlab.com. - LEGACY_URL = 'https://codesuggestions.gitlab.com' - private_constant :LEGACY_URL - def self.url - if Feature.enabled?('use_cloud_connector_lb', type: :experiment) - ENV['AI_GATEWAY_URL'] || "#{::CloudConnector::Config.base_url}/ai" - else - # TODO: Rename to `AI_GATEWAY_URL` - # See https://gitlab.com/gitlab-org/gitlab/-/issues/434671 - # - ENV['CODE_SUGGESTIONS_BASE_URL'] || LEGACY_URL - end + ENV['AI_GATEWAY_URL'] || "#{::CloudConnector::Config.base_url}/ai" end end end diff --git a/ee/spec/lib/code_suggestions/tasks/base_spec.rb b/ee/spec/lib/code_suggestions/tasks/base_spec.rb index b30e14c5ccb41be5dbe39c83c630368cb1979922..b433792ec6b06c6d4020997c85045d91a27c20cc 100644 --- a/ee/spec/lib/code_suggestions/tasks/base_spec.rb +++ b/ee/spec/lib/code_suggestions/tasks/base_spec.rb @@ -6,28 +6,6 @@ subject { described_class.new } describe '.base_url' do - context 'when use_cloud_connector_lb is disabled' do - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - context 'without CODE_SUGGESTIONS_BASE_URL env var' do - it 'returns correct URL' do - expect(described_class.base_url).to eql('https://codesuggestions.gitlab.com') - end - end - - context 'with CODE_SUGGESTIONS_BASE_URL env var' do - before do - stub_env('CODE_SUGGESTIONS_BASE_URL', 'http://test.local') - end - - it 'returns correct URL' do - expect(described_class.base_url).to eql('http://test.local') - end - end - end - it 'returns correct URL' do expect(described_class.base_url).to eql('https://cloud.gitlab.com/ai') end diff --git a/ee/spec/requests/api/code_suggestions_spec.rb b/ee/spec/requests/api/code_suggestions_spec.rb index aec04528b456b6796275b0d02ac4260c86311310..7c035a4b4975b9f86e8110800631e8236a6bc837 100644 --- a/ee/spec/requests/api/code_suggestions_spec.rb +++ b/ee/spec/requests/api/code_suggestions_spec.rb @@ -321,42 +321,6 @@ def request ) end - context 'when use_cloud_connector_lb ff is disabled' do - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - context 'when service base URL is not set' do - before do - stub_env('CODE_SUGGESTIONS_BASE_URL', nil) - end - - it 'sends requests to this URL instead' do - post_api - - _, params = workhorse_send_data - expect(params).to include({ - 'URL' => 'https://codesuggestions.gitlab.com/v2/code/completions' - }) - end - end - - context 'when overriding service base URL' do - before do - stub_env('CODE_SUGGESTIONS_BASE_URL', 'http://test.com') - end - - it 'sends requests to this URL instead' do - post_api - - _, params = workhorse_send_data - expect(params).to include({ - 'URL' => 'http://test.com/v2/code/completions' - }) - end - end - end - context 'with telemetry headers' do let(:headers) do { @@ -604,34 +568,6 @@ def get_user(session): post_api end - context 'when use_cloud_connector_lb is disabled' do - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - it 'sends requests to the code generation endpoint' do - expected_body = body.merge( - model_provider: 'anthropic', - prompt_version: 2, - prompt: prompt, - current_file: { - file_name: file_name, - content_above_cursor: prefix, - content_below_cursor: '' - }, - model_name: 'claude-2.1' - ) - expect(Gitlab::Workhorse) - .to receive(:send_url) - .with( - 'https://codesuggestions.gitlab.com/v2/code/generations', - hash_including(body: expected_body.to_json) - ) - - post_api - end - end - it 'includes additional headers for SaaS' do add_on_purchase.namespace.namespace_settings.update_attribute(:code_suggestions, true) @@ -791,35 +727,6 @@ def get_user(session): post_api end - context 'when use_cloud_connector_lb is disabled' do - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - it 'sends requests to the code generation endpoint' do - expected_body = body.merge( - model_provider: 'anthropic', - prompt_version: 2, - prompt: prompt, - current_file: { - file_name: file_name, - content_above_cursor: prefix, - content_below_cursor: '' - }, - model_name: 'claude-2.1' - ) - - expect(Gitlab::Workhorse) - .to receive(:send_url) - .with( - 'https://codesuggestions.gitlab.com/v2/code/generations', - hash_including(body: expected_body.to_json) - ) - - post_api - end - end - context 'when body is too big' do before do stub_const("#{described_class}::MAX_BODY_SIZE", 10) diff --git a/ee/spec/requests/api/internal/ai/x_ray/scan_spec.rb b/ee/spec/requests/api/internal/ai/x_ray/scan_spec.rb index e52655e8565ac06b9260096f79eb90a19a7b4b5a..e7fe1e37b04e1d1404c67de9b21f82455a14cc65 100644 --- a/ee/spec/requests/api/internal/ai/x_ray/scan_spec.rb +++ b/ee/spec/requests/api/internal/ai/x_ray/scan_spec.rb @@ -70,16 +70,6 @@ end end - context 'when use_cloud_connector_lb is disabled' do - let(:endpoint) { 'https://codesuggestions.gitlab.com/v1/x-ray/libraries' } - - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - include_examples 'sends request to the XRay libraries' - end - include_examples 'sends request to the XRay libraries' end diff --git a/ee/spec/support/shared_examples/lib/code_suggestions/task_shared_examples.rb b/ee/spec/support/shared_examples/lib/code_suggestions/task_shared_examples.rb index 46ededafbc02adee0a6054ec64f836e16e055667..6b396e669f4eaab1fea1aaaf616af3176e0074a9 100644 --- a/ee/spec/support/shared_examples/lib/code_suggestions/task_shared_examples.rb +++ b/ee/spec/support/shared_examples/lib/code_suggestions/task_shared_examples.rb @@ -4,25 +4,11 @@ let(:base_url) { 'https://cloud.gitlab.com/ai' } let(:endpoint) { "#{base_url}/#{endpoint_path}" } - shared_examples_for 'valid endpoint' do - it 'returns valid endpoint' do - expect(task.endpoint).to eq endpoint - end - - it 'returns body' do - expect(Gitlab::Json.parse(task.body)).to eq body - end + it 'returns valid endpoint' do + expect(task.endpoint).to eq endpoint end - include_examples 'valid endpoint' - - context 'when use_cloud_connector_lb is disabled' do - let(:base_url) { 'https://codesuggestions.gitlab.com' } - - before do - stub_feature_flags(use_cloud_connector_lb: false) - end - - include_examples 'valid endpoint' + it 'returns body' do + expect(Gitlab::Json.parse(task.body)).to eq body end end