diff --git a/config/initializers/active_context.rb b/config/initializers/active_context.rb index a03ba727088ed01c6386102b7ac5ed0474ba6f28..1cb3f39a7103881d88887696edbefcbbe7fb7ee1 100644 --- a/config/initializers/active_context.rb +++ b/config/initializers/active_context.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true ActiveContext.configure do |config| - config.enabled = false - config.indexing_enabled = false + config.enabled = true + config.indexing_enabled = true end diff --git a/ee/app/graphql/ee/graphql_triggers.rb b/ee/app/graphql/ee/graphql_triggers.rb index d612c957ab61f0d970c011dfc65a2954882a3535..d83a598d08d05a762d912acac38fd164026ad945 100644 --- a/ee/app/graphql/ee/graphql_triggers.rb +++ b/ee/app/graphql/ee/graphql_triggers.rb @@ -6,6 +6,7 @@ module GraphqlTriggers prepended do def self.ai_completion_response(message) + debugger subscription_arguments = { user_id: message.user.to_gid, ai_action: message.ai_action.to_s @@ -19,7 +20,11 @@ def self.ai_completion_response(message) subscription_arguments[:client_subscription_id] = message.client_subscription_id end - ::GitlabSchema.subscriptions.trigger(:ai_completion_response, subscription_arguments, message.to_h) + ::GitlabSchema.subscriptions.trigger( + :ai_completion_response, + subscription_arguments, + message.to_h + ) # Once all clients `ai_action` we can remove this trigger duplicate . # Clients that use the `ai_action` parameter to subscribe on, no longer need to subscribe on the diff --git a/ee/app/graphql/mutations/ai/action.rb b/ee/app/graphql/mutations/ai/action.rb index b75aae799172010df9058cc19fbf3e8f88b18846..aa7810152a405bd76507a42210cc6d7c9bb91f6d 100644 --- a/ee/app/graphql/mutations/ai/action.rb +++ b/ee/app/graphql/mutations/ai/action.rb @@ -77,6 +77,8 @@ def graphql_query_details end def resolve(**attributes) + # debugger + # tgao started_at = Gitlab::Metrics::System.real_time verify_rate_limit! @@ -90,8 +92,35 @@ def resolve(**attributes) **graphql_query_details ) + debugger resource_id, method, options = extract_method_params!(attributes) - + # { + # "client_subscription_id": "4344a514-d4d4-4e52-a8f4-74ac9b2dbcb7", + # "platform_origin": "vs_code_extension", + # "content": "could you describe this project?", + # "current_file": { + # "file_name": "Untitled-2", + # "selected_text": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", + # "content_above_cursor": "make && \\\nGITLAB_INDEXER_MODE=chunk \\\nGITLAB_INDEXER_DEBUG_LOGGING=1 \\\n./bin/gitlab-elasticsearch-indexer \\\n-adapter \"elasticsearch\" \\\n-connection '{\"url\": [\"http://localhost:9200\"]}' \\\n-options '{\n \"timeout\": \"30m\",\n \"chunk_size\": 1000,\n \"gitaly_batch_size\": 1000,\n \"from_sha\": \"\",\n \"to_sha\": \"\",\n \"project_id\": 2,\n \"partition_name\": \"gitlab_active_context_code\",\n \"partition_number\": 0,\n \"gitaly_config\": {\n \"address\": \"unix:/Users/tiangao/tgao_gitlab/gitlab-development-kit/praefect.socket\",\n \"storage\": \"default\",\n \"relative_path\": \"@hashed/d4/73/d4735e3a265e16eee03f59718b9b5d03019c07d8b6c51f90da3a666eec13ab35.git\",\n \"project_path\": \"gitlab-org/gitlab-test\"\n }\n}'\n\n\n\n{:sort=>nil, :with_code_embeddings_indexed=>true}\n\ndef test(args)\n current_user = User.first\n project_finder = ProjectsFinder.new(current_user: current_user, params: finder_params(args), project_ids_relation: parse_gids(args[:ids]))\n projects = project_finder.execute\n projects = project_finder.filter_by_context_storage(projects)\n projects.each { |project| BatchLoader::GraphQL.wrap(project.self_or_ancestors_archived?) }\nend\n\n\n", + # "content_below_cursor": "" + # }, + # "additional_context": [ + # { + # "id": "editor_selection:Untitled-2_c6c8c411-f469-48fe-8e14-d32a5d0ee938", + # "category": "snippet", + # "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", + # "metadata": { + # "title": "Selected text in Untitled-2", + # "enabled": true, + # "icon": "selection", + # "subType": "snippet", + # "subTypeLabel": "Editor Selection", + # "secondaryText": "Untitled-2", + # "fileName": "Untitled-2" + # } + # } + # ] + # } check_feature_flag_enabled!(method) resource = find_resource(GlobalID.parse(resource_id), options[:project_id]) diff --git a/ee/app/services/llm/execute_method_service.rb b/ee/app/services/llm/execute_method_service.rb index 52e114604c9351c6a6bb73e8cef599bcdc1232df..611c355e62c0a4b634405e2a5b3459739cee8969 100644 --- a/ee/app/services/llm/execute_method_service.rb +++ b/ee/app/services/llm/execute_method_service.rb @@ -9,6 +9,8 @@ def initialize(user, resource, method, options = {}) end def execute + debugger + # tgao full_methods_list = ::Gitlab::Llm::Utils::AiFeaturesCatalogue::LIST return error('Unknown method') unless full_methods_list.key?(method) diff --git a/ee/app/workers/llm/completion_worker.rb b/ee/app/workers/llm/completion_worker.rb index 0cde546cf402c8fb1f237a6f463bbe376f26a3f8..1c002a7336b2d3d31306179c075dcb6c4beaead1 100644 --- a/ee/app/workers/llm/completion_worker.rb +++ b/ee/app/workers/llm/completion_worker.rb @@ -42,10 +42,11 @@ def deserialize_message(message_hash, options) end def perform_for(message, options = {}) - # set SESSION_ID_HASH_KEY to ensure inside Sidekiq `Gitlab::Session.current` is not nil - with_ip_address_state.set( - Gitlab::SidekiqMiddleware::SetSession::Server::SESSION_ID_HASH_KEY => ::Gitlab::Session.session_id_for_worker - ).perform_async(serialize_message(message), options) + # # set SESSION_ID_HASH_KEY to ensure inside Sidekiq `Gitlab::Session.current` is not nil + # with_ip_address_state.set( + # Gitlab::SidekiqMiddleware::SetSession::Server::SESSION_ID_HASH_KEY => ::Gitlab::Session.session_id_for_worker + # ).perform_async(serialize_message(message), options) + self.new.perform(serialize_message(message), options) end def resource(message_hash) @@ -58,6 +59,7 @@ def resource(message_hash) end def perform(prompt_message_hash, options = {}) + debugger ai_prompt_message = self.class.deserialize_message(prompt_message_hash, options) # set warden to ensure SsoEnforcer#in_context_of_user_web_activity? returns true diff --git a/ee/lib/ai/active_context/queries/code.rb b/ee/lib/ai/active_context/queries/code.rb index ddb81816f7859ba7cb174ed36a30e4432cdcec91..b0c52c9b8524805629d6c614067fa187c252af1f 100644 --- a/ee/lib/ai/active_context/queries/code.rb +++ b/ee/lib/ai/active_context/queries/code.rb @@ -22,7 +22,7 @@ def filter(project_id:, path: nil) "A Code collection record is required." ) end - + debugger query = path.nil? ? repository_query(project_id) : directory_query(project_id, path) COLLECTION_CLASS.search(query: query, user: user) diff --git a/ee/lib/gitlab/duo/chat/react_executor.rb b/ee/lib/gitlab/duo/chat/react_executor.rb index f8f6c5d24f3c860f63d78832447ae31284a9d281..5988e26242007b7530d971ba237494750ddc5c39 100644 --- a/ee/lib/gitlab/duo/chat/react_executor.rb +++ b/ee/lib/gitlab/duo/chat/react_executor.rb @@ -42,9 +42,12 @@ def initialize(user_input:, tools:, context:, response_handler:, stream_response def execute MAX_ITERATIONS.times do |i| + debugger @retry_attempt = 0 events = with_agent_retry { step_forward } + debugger + raise EmptyEventsError if events.empty? answer = process_final_answer(events) || @@ -230,9 +233,46 @@ def step_executor end def step_forward + debugger streamed_answer = Gitlab::Llm::Chain::StreamedAnswer.new - step_executor.step(step_params) do |event| + # { + # "messages": [ + # { + # "role": "user", + # "content": "could you describe this repository?", + # "additional_context": null, + # "agent_scratchpad": null + # }, + # { + # "role": "assistant", + # "content": "I don't have access to any specific repository information. To describe a repository, I would need you to provide:\n\n- A repository URL\n- The repository name and namespace/group\n- Or be viewing a specific repository page\n\nIf you're currently viewing a repository on GitLab, you could ask about specific aspects like:\n- The project's README file\n- CI/CD configuration\n- File structure\n- Recent commits or merge requests\n\nCould you please provide the repository details or specify what particular aspect of a repository you'd like me to help explain?", + # "additional_context": null, + # "agent_scratchpad": [] + # }, + # { + # "role": "user", + # "content": "could you describe this project?", + # "additional_context": [ + # { + # "id": "editor_selection:Untitled-2_c6c8c411-f469-48fe-8e14-d32a5d0ee938", + # "category": "snippet", + # "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", + # "metadata": { + # "title": "Selected text in Untitled-2", + # "enabled": true, + # "icon": "selection", + # "subType": "snippet", + # "subTypeLabel": "Editor Selection", + # "secondaryText": "Untitled-2", + # "fileName": "Untitled-2" + # } + # } + # ], + # "agent_scratchpad": null + # }, + rr = step_executor.step(step_params) do |event| + debugger if event.instance_of? Gitlab::Duo::Chat::AgentEvents::Error raise RetryableAgentEventError, event.message if event.retryable? @@ -248,12 +288,16 @@ def step_forward record_first_token_apex if chunk[:id] == 1 # first streamed token + # Gitlab::Llm::ResponseService stream_response_handler.execute( response: Gitlab::Llm::Chain::StreamedResponseModifier .new(chunk[:content], chunk_id: chunk[:id]), options: { chunk_id: chunk[:id] } ) end + + debugger + rr end def step_params @@ -394,3 +438,804 @@ def save_agent_steps_to_answer(answer) end end end + + +# (byebug) puts JSON.pretty_generate(step_params) +# CACHE Ai::Conversation::Message Load (90.5ms) SELECT "ai_conversation_messages".* FROM "ai_conversation_messages" WHERE "ai_conversation_messages"."thread_id" = 1 ORDER BY "ai_conversation_messages"."id" DESC LIMIT 50 +# ↳ ee/app/models/ai/conversation/message.rb:45:in `recent' +# License Load (12.1ms) SELECT "licenses".* FROM "licenses" ORDER BY "licenses"."id" DESC LIMIT 100 /*application:web,correlation_id:01K051QFQKTK0K5A426XG46CNR,endpoint_id:GraphqlController#execute,db_config_database:gitlabhq_development,db_config_name:main,line:/ee/app/models/license.rb:94:in `filter_map'*/ +# ↳ ee/app/models/license.rb:94:in `filter_map' +# CACHE GitlabSubscriptions::AddOn Pluck (2.6ms) SELECT "subscription_add_ons"."id" FROM "subscription_add_ons" WHERE "subscription_add_ons"."name" = 1 LIMIT 1 +# ↳ ee/app/models/gitlab_subscriptions/add_on_purchase.rb:53:in `block in ' +# CACHE GitlabSubscriptions::AddOn Pluck (2.5ms) SELECT "subscription_add_ons"."id" FROM "subscription_add_ons" WHERE "subscription_add_ons"."name" = 3 LIMIT 1 +# ↳ ee/app/models/gitlab_subscriptions/add_on_purchase.rb:55:in `block in ' +# CACHE GitlabSubscriptions::AddOnPurchase Exists? (2.2ms) SELECT 1 AS one FROM "subscription_add_on_purchases" WHERE ("subscription_add_on_purchases"."subscription_add_on_id" = 1 OR "subscription_add_on_purchases"."subscription_add_on_id" = 3) AND (started_at IS NULL OR started_at <= '2025-07-14') AND ('2025-07-14' < expires_on) LIMIT 1 +# ↳ ee/lib/ai/amazon_q.rb:12:in `feature_available?' +# { +# "messages": [ +# { +# "role": "user", +# "content": "could you describe this repository?", +# "additional_context": null, +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "I don't have access to any specific repository information. To describe a repository, I would need you to provide:\n\n- A repository URL\n- The repository name and namespace/group\n- Or be viewing a specific repository page\n\nIf you're currently viewing a repository on GitLab, you could ask about specific aspects like:\n- The project's README file\n- CI/CD configuration\n- File structure\n- Recent commits or merge requests\n\nCould you please provide the repository details or specify what particular aspect of a repository you'd like me to help explain?", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this repo?", +# "additional_context": null, +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "I don't have access to the specific repository you're referring to. To help describe a repository, I would need you to provide:\n\n- The repository URL\n- The repository name and project path\n- Or specific details about what you'd like me to explain\n\nIf you're currently viewing a GitLab repository, you could share:\n- The project URL\n- Specific files you'd like explained (like README, CI/CD configuration)\n- Particular aspects you're interested in (architecture, dependencies, etc.)\n\nWhat specific repository details would you like help with?", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": null, +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "I don't have access to any specific project information. To describe a project, I would need you to provide:\n\n- The project URL or GitLab link\n- The project name and namespace/group\n- Specific project details you'd like me to explain\n\nIf you're currently viewing a GitLab project, you could ask about:\n- Project documentation or README\n- CI/CD pipelines and configuration\n- Repository structure and files\n- Issues, merge requests, or recent activity\n- Project settings and features\n\nCould you please share the project URL or specify which project you'd like me to help describe?", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "editor_selection:Untitled-2_c6c8c411-f469-48fe-8e14-d32a5d0ee938", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "This SQL query retrieves projects that are configured for AI active context code repositories. Here's what it does:\n\n## Query Structure\n\n**CTE (Common Table Expression) - `filtered_projects`:**\n- Filters projects based on user access permissions (user_id = 1) OR public visibility levels (0, 10, 20)\n- Excludes projects that are pending deletion or hidden\n- Orders results by project ID in descending order\n\n**Main Query:**\n- Joins the filtered projects with AI-related tables:\n - `p_ai_active_context_code_repositories` (aliased as `paccr`)\n - `ai_active_context_connections` (aliased as `active_context_connection`)\n\n## Key Filtering Criteria\n\n- **User Access**: Projects where user ID 1 has authorization OR projects with visibility levels 0, 10, or 20\n- **Project State**: Only active projects (not pending delete, not hidden)\n- **AI Context State**: Only repositories with state = 10 (likely an \"active\" or \"enabled\" state)\n- **Connection Status**: Only active AI context connections\n\n## Purpose\n\nThis appears to be querying for GitLab projects that are:\n1. Accessible to a specific user or publicly visible\n2. Configured for AI-powered code context features\n3. Currently active and properly connected\n\nThe query likely supports GitLab's AI features that need access to code repositories for context analysis.\n\nWould you like more details about any specific part of this query or its potential use cases?", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "editor_selection:Untitled-2_e2741ddc-1bac-4ba0-845d-b956e120e530", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "This SQL query retrieves GitLab projects that are enabled for AI active context features. Here's the breakdown:\n\n## Query Purpose\nFinds projects accessible to a specific user that are configured for AI-powered code analysis and context generation.\n\n## Two-Stage Filtering\n\n**Stage 1 - `filtered_projects` CTE:**\n- Gets projects where user ID 1 has explicit authorization OR projects with public visibility levels\n- Excludes deleted/hidden projects\n- Orders by newest projects first (DESC)\n\n**Stage 2 - Main Query:**\n- Joins with AI context tables to find projects actively participating in AI features\n- Ensures the AI connection is active and the repository state is \"enabled\" (state = 10)\n\n## Key Components\n\n**Access Control:**\n- `project_authorizations`: User-specific project permissions\n- `visibility_level IN (0, 10, 20)`: Public, internal, or private visibility levels\n\n**AI Integration:**\n- `p_ai_active_context_code_repositories`: Links projects to AI context system\n- `ai_active_context_connections`: Manages AI service connections\n- `state = 10`: Likely indicates \"active/enabled\" status\n\n**Data Quality:**\n- Filters out projects pending deletion or hidden\n- Ensures AI connections are active\n\nThis query appears to support GitLab's AI features like code suggestions, explanations, or automated analysis by identifying which repositories are properly configured and accessible for AI processing.\n\nWould you like more details about the specific table relationships or optimization opportunities?", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "editor_selection:Untitled-2_28aa1282-f860-4f96-8630-73923ece93c3", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "This SQL query retrieves GitLab projects that are configured for AI active context code analysis. Here's what it does:\n\n## Query Structure\n\n**CTE (`filtered_projects`):**\n- Filters projects based on user access (user_id = 1) OR public visibility levels (0, 10, 20)\n- Excludes projects pending deletion (`pending_delete = false`) or hidden (`hidden = false`)\n- Orders by project ID descending (newest first)\n\n**Main Query:**\n- Joins filtered projects with AI context tables\n- Links projects to their AI active context configuration (`p_ai_active_context_code_repositories`)\n- Ensures AI connections are active (`ai_active_context_connections.active = TRUE`)\n\n## Key Filtering Criteria\n\n- **Access Control**: Projects accessible to user ID 1 or with appropriate visibility levels\n- **AI State**: Only repositories with `state = 10` (likely \"enabled\" status)\n- **Connection Status**: Only active AI context connections\n- **Data Quality**: Excludes deleted/hidden projects\n\n## Purpose\n\nThis query supports GitLab's AI features by identifying projects that are:\n1. Accessible to the requesting user\n2. Properly configured for AI code context analysis\n3. Currently active and connected to AI services\n\nThe redundant `WHERE paccr.project_id IN (SELECT id FROM filtered_projects)` condition could be optimized since the JOIN already ensures this relationship.\n\nThis appears to be part of GitLab's AI-powered code assistance features, filtering repositories that can be used for context in AI responses.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_2be9e97c-1663-41dc-b254-87a1ffbcaffc", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Context\nThis appears to be a test project within the GitLab Duo namespace, likely used for testing GitLab's AI-powered features. The SQL query you've shared is designed to retrieve projects that are configured for AI active context code repositories, and this test project seems to be part of that ecosystem.\n\n## SQL Query Relationship\nThe SQL query filters for projects that:\n- Are accessible to user ID 1 (which may be related to this test project)\n- Have AI active context features enabled\n- Are properly connected to GitLab's AI services\n\nGiven the project path \"gitlab-duo/test\", this is likely a development or testing repository used by the GitLab team to test AI features like GitLab Duo Chat and other AI-powered development tools.\n\nThe project appears to be set up specifically for testing AI context features, which would explain why it's being queried alongside the AI active context tables in your SQL code.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_4e93c9fd-5878-48ae-8f9d-3645d87899de", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test \n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within the GitLab Duo namespace, specifically designed for testing GitLab's AI-powered features and capabilities.\n\n## Connection to the SQL Query\nThe SQL query you've selected is designed to retrieve projects that are configured for AI active context code repositories. This test project (ID: 1000000) would likely be included in the results if it meets the criteria:\n\n- Has proper user authorization or appropriate visibility level\n- Is configured for AI active context features (`p_ai_active_context_code_repositories`)\n- Has an active AI connection\n- Has state = 10 (enabled for AI context)\n\n## Context\nGiven the \"gitlab-duo\" namespace, this is likely an internal GitLab project used by the development team to test and validate AI features like:\n- GitLab Duo Chat\n- Code suggestions\n- AI-powered code analysis\n- Context-aware AI responses\n\nThe project serves as a controlled environment for testing how AI features interact with real GitLab projects and repositories.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_a7006be3-a522-48f9-a7e5-9b58594c1092", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within the GitLab Duo namespace, specifically designed for testing GitLab's AI-powered features and development workflows.\n\n## Key Characteristics\n- **Namespace**: Part of the \"gitlab-duo\" group, indicating it's related to GitLab's AI initiatives\n- **Purpose**: Likely used for testing and validating AI features like GitLab Duo Chat, code suggestions, and AI-powered development tools\n- **Environment**: Serves as a controlled testing environment for AI feature development\n\n## Relationship to the SQL Query\nThe SQL query you've selected is designed to retrieve projects configured for AI active context code repositories. This test project would be included in results if it:\n- Has proper user authorization or visibility settings\n- Is configured for AI active context features\n- Has an active AI connection with state = 10 (enabled)\n\nThis project appears to be part of GitLab's internal infrastructure for developing and testing AI-powered development assistance features.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_9681a8cc-4991-4970-980e-2e69405757f9", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within the GitLab Duo namespace, specifically designed for testing GitLab's AI-powered features and development workflows.\n\n## Key Characteristics\n- **Namespace**: Part of the \"gitlab-duo\" group, indicating it's related to GitLab's AI initiatives\n- **Purpose**: Likely used for testing and validating AI features like GitLab Duo Chat, code suggestions, and AI-powered development tools\n- **Environment**: Serves as a controlled testing environment for AI feature development\n\n## Connection to AI Features\nThe SQL query you've selected retrieves projects configured for AI active context code repositories. This test project would be included in results if it meets the criteria for AI-enabled projects, suggesting it's actively used for testing GitLab's AI capabilities.\n\nThis project appears to be part of GitLab's internal infrastructure for developing and testing AI-powered development assistance features.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_1e89f5be-a110-4112-9ef1-5b99ab9f818a", +# "category": "snippet", +# "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within the GitLab Duo namespace, specifically designed for testing GitLab's AI-powered features and development workflows.\n\n## SQL Query Analysis\nThe selected SQL code retrieves projects that are configured for AI active context code repositories. Here's what it does:\n\n**CTE (`filtered_projects`):**\n- Filters projects accessible to user ID 1 OR with public visibility levels (0, 10, 20)\n- Excludes projects pending deletion or hidden\n- Orders by newest projects first\n\n**Main Query:**\n- Joins with AI context tables (`p_ai_active_context_code_repositories` and `ai_active_context_connections`)\n- Ensures AI connections are active and repositories have state = 10 (enabled)\n\n## Connection Between Project and Query\nThis test project (gitlab-duo/test) would likely be included in the query results if it's configured for AI features, making it part of GitLab's infrastructure for testing AI-powered development assistance capabilities like GitLab Duo Chat and code suggestions.\n\nThe project serves as a controlled environment for validating how AI features interact with GitLab repositories and projects.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "file:///Users/tiangao/tgao_gitlab/gitlab-shell/client/tgao.go", +# "category": "file", +# "content": "// write a function to find the max\nfunc max_num(a int, b int){\n\tif a>b{\n\t\treturn a\n\t}else{\n\t\treturn b \n\t}\n}\n\n\n// write a function to find the min\nfunc min_num(a int, b int){\n\tif a max{\n\t\t\tmax = math.Abs(value)\n\t\t}else{ \n\t\t\tmax = max\n\t\t}\n\t}\n\treturn max\n}\n\n// write a function to find the number with min abs value from an array\n\n\nSELECT\n \"projects\".\"id\",\n \"projects\".\"name\",\n \"projects\".\"path\",\n \"projects\".\"description\",\n \"projects\".\"created_at\",\n \"projects\".\"updated_at\",\n \"projects\".\"creator_id\",\n \"projects\".\"namespace_id\",\n \"projects\".\"last_activity_at\",\n \"projects\".\"import_url\",\n \"projects\".\"visibility_level\",\n \"projects\".\"archived\",\n \"projects\".\"avatar\",\n \"projects\".\"merge_requests_template\",\n \"projects\".\"star_count\",\n \"projects\".\"merge_requests_rebase_enabled\",\n \"projects\".\"import_type\",\n \"projects\".\"import_source\",\n \"projects\".\"approvals_before_merge\",\n \"projects\".\"reset_approvals_on_push\",\n \"projects\".\"merge_requests_ff_only_enabled\",\n \"projects\".\"issues_template\",\n \"projects\".\"mirror\",\n \"projects\".\"mirror_last_update_at\",\n \"projects\".\"mirror_last_successful_update_at\",\n \"projects\".\"mirror_user_id\",\n \"projects\".\"shared_runners_enabled\",\n \"projects\".\"runners_token\",\n \"projects\".\"build_allow_git_fetch\",\n \"projects\".\"build_timeout\",\n \"projects\".\"mirror_trigger_builds\",\n \"projects\".\"pending_delete\",\n \"projects\".\"public_builds\",\n \"projects\".\"last_repository_check_failed\",\n \"projects\".\"last_repository_check_at\",\n \"projects\".\"only_allow_merge_if_pipeline_succeeds\",\n \"projects\".\"has_external_issue_tracker\",\n \"projects\".\"repository_storage\",\n \"projects\".\"repository_read_only\",\n \"projects\".\"request_access_enabled\",\n \"projects\".\"has_external_wiki\",\n \"projects\".\"ci_config_path\",\n \"projects\".\"lfs_enabled\",\n \"projects\".\"description_html\",\n \"projects\".\"only_allow_merge_if_all_discussions_are_resolved\",\n \"projects\".\"repository_size_limit\",\n \"projects\".\"printing_merge_request_link_enabled\",\n \"projects\".\"auto_cancel_pending_pipelines\",\n \"projects\".\"service_desk_enabled\",\n \"projects\".\"cached_markdown_version\",\n \"projects\".\"delete_error\",\n \"projects\".\"last_repository_updated_at\",\n \"projects\".\"disable_overriding_approvers_per_merge_request\",\n \"projects\".\"storage_version\",\n \"projects\".\"resolve_outdated_diff_discussions\",\n \"projects\".\"remote_mirror_available_overridden\",\n \"projects\".\"only_mirror_protected_branches\",\n \"projects\".\"pull_mirror_available_overridden\",\n \"projects\".\"jobs_cache_index\",\n \"projects\".\"external_authorization_classification_label\",\n \"projects\".\"mirror_overwrites_diverged_branches\",\n \"projects\".\"pages_https_only\",\n \"projects\".\"external_webhook_token\",\n \"projects\".\"packages_enabled\",\n \"projects\".\"merge_requests_author_approval\",\n \"projects\".\"pool_repository_id\",\n \"projects\".\"runners_token_encrypted\",\n \"projects\".\"bfg_object_map\",\n \"projects\".\"detected_repository_languages\",\n \"projects\".\"merge_requests_disable_committers_approval\",\n \"projects\".\"require_password_to_approve\",\n \"projects\".\"max_pages_size\",\n \"projects\".\"max_artifacts_size\",\n \"projects\".\"pull_mirror_branch_prefix\",\n \"projects\".\"remove_source_branch_after_merge\",\n \"projects\".\"marked_for_deletion_at\",\n \"projects\".\"marked_for_deletion_by_user_id\",\n \"projects\".\"autoclose_referenced_issues\",\n \"projects\".\"suggestion_commit_message\",\n \"projects\".\"project_namespace_id\",\n \"projects\".\"hidden\",\n \"projects\".\"organization_id\"\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"hidden\" = FALSE\nAND \"projects\".\"id\" in (2,4,5,7,8,1,6,9,10)\nLIMIT 11\n\n\n\n\nSELECT\n \"projects\".\"id\",\n \"projects\".\"name\",\n \"projects\".\"path\",\n \"projects\".\"description\",\n \"projects\".\"created_at\",\n \"projects\".\"updated_at\",\n \"projects\".\"creator_id\",\n \"projects\".\"namespace_id\",\n \"projects\".\"last_activity_at\",\n \"projects\".\"import_url\",\n \"projects\".\"visibility_level\",\n \"projects\".\"archived\",\n \"projects\".\"avatar\",\n \"projects\".\"merge_requests_template\",\n \"projects\".\"star_count\",\n \"projects\".\"merge_requests_rebase_enabled\",\n \"projects\".\"import_type\",\n \"projects\".\"import_source\",\n \"projects\".\"approvals_before_merge\",\n \"projects\".\"reset_approvals_on_push\",\n \"projects\".\"merge_requests_ff_only_enabled\",\n \"projects\".\"issues_template\",\n \"projects\".\"mirror\",\n \"projects\".\"mirror_last_update_at\",\n \"projects\".\"mirror_last_successful_update_at\",\n \"projects\".\"mirror_user_id\",\n \"projects\".\"shared_runners_enabled\",\n \"projects\".\"runners_token\",\n \"projects\".\"build_allow_git_fetch\",\n \"projects\".\"build_timeout\",\n \"projects\".\"mirror_trigger_builds\",\n \"projects\".\"pending_delete\",\n \"projects\".\"public_builds\",\n \"projects\".\"last_repository_check_failed\",\n \"projects\".\"last_repository_check_at\",\n \"projects\".\"only_allow_merge_if_pipeline_succeeds\",\n \"projects\".\"has_external_issue_tracker\",\n \"projects\".\"repository_storage\",\n \"projects\".\"repository_read_only\",\n \"projects\".\"request_access_enabled\",\n \"projects\".\"has_external_wiki\",\n \"projects\".\"ci_config_path\",\n \"projects\".\"lfs_enabled\",\n \"projects\".\"description_html\",\n \"projects\".\"only_allow_merge_if_all_discussions_are_resolved\",\n \"projects\".\"repository_size_limit\",\n \"projects\".\"printing_merge_request_link_enabled\",\n \"projects\".\"auto_cancel_pending_pipelines\",\n \"projects\".\"service_desk_enabled\",\n \"projects\".\"cached_markdown_version\",\n \"projects\".\"delete_error\",\n \"projects\".\"last_repository_updated_at\",\n \"projects\".\"disable_overriding_approvers_per_merge_request\",\n \"projects\".\"storage_version\",\n \"projects\".\"resolve_outdated_diff_discussions\",\n \"projects\".\"remote_mirror_available_overridden\",\n \"projects\".\"only_mirror_protected_branches\",\n \"projects\".\"pull_mirror_available_overridden\",\n \"projects\".\"jobs_cache_index\",\n \"projects\".\"external_authorization_classification_label\",\n \"projects\".\"mirror_overwrites_diverged_branches\",\n \"projects\".\"pages_https_only\",\n \"projects\".\"external_webhook_token\",\n \"projects\".\"packages_enabled\",\n \"projects\".\"merge_requests_author_approval\",\n \"projects\".\"pool_repository_id\",\n \"projects\".\"runners_token_encrypted\",\n \"projects\".\"bfg_object_map\",\n \"projects\".\"detected_repository_languages\",\n \"projects\".\"merge_requests_disable_committers_approval\",\n \"projects\".\"require_password_to_approve\",\n \"projects\".\"max_pages_size\",\n \"projects\".\"max_artifacts_size\",\n \"projects\".\"pull_mirror_branch_prefix\",\n \"projects\".\"remove_source_branch_after_merge\",\n \"projects\".\"marked_for_deletion_at\",\n \"projects\".\"marked_for_deletion_by_user_id\",\n \"projects\".\"autoclose_referenced_issues\",\n \"projects\".\"suggestion_commit_message\",\n \"projects\".\"project_namespace_id\",\n \"projects\".\"hidden\",\n \"projects\".\"organization_id\"\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"hidden\" = FALSE\nAND \"projects\".\"id\" in (4)\nLIMIT 11\n", +# "metadata": { +# "languageId": "go", +# "title": "tgao.go", +# "project": "gitlab-org/gitlab-shell", +# "enabled": true, +# "disabledReasons": [], +# "icon": "document", +# "secondaryText": "client/tgao.go", +# "subType": "open_tab", +# "subTypeLabel": "Project file", +# "relativePath": "client/tgao.go", +# "workspaceFolder": { +# "uri": "file:///Users/tiangao/tgao_gitlab/gitlab-shell", +# "name": "gitlab-shell" +# }, +# "lastAccessed": 1751550227914, +# "lastModified": 1751550227914, +# "byteSize": 8901 +# } +# }, +# { +# "id": "editor_selection:Untitled-2_2b263cb4-8660-471d-8c3a-0b0960e43002", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## SQL Query Analysis\nThe selected SQL query is specifically designed to retrieve this project (ID 1000000) if it meets AI active context criteria:\n\n**Key Components:**\n- **Target**: Specifically filters for `projects.id = 1000000`\n- **AI Integration**: Joins with AI context tables to ensure the project is enabled for AI features\n- **Access Control**: Checks user authorization (user_id = 1) or public visibility levels (0, 10, 20)\n- **Data Quality**: Excludes projects that are pending deletion or hidden\n\n**Purpose**: This query verifies that project 1000000 (gitlab-duo/test) is:\n1. Accessible to the requesting user\n2. Configured for AI active context code repositories (`state = 10`)\n3. Connected to active AI services\n4. Not deleted or hidden\n\n## Project Context\nThis appears to be a test project within GitLab's AI development infrastructure, specifically used for testing GitLab Duo features like AI-powered code assistance, context analysis, and chat capabilities.\n\nThe query structure suggests this project is actively used for validating AI functionality within GitLab's development environment.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_535332b5-e7b0-4aa0-b066-9f5a4ad79216", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## SQL Query Analysis\nThe selected SQL query is specifically designed to retrieve this exact project if it meets AI active context criteria:\n\n**Query Purpose:**\n- Targets project ID 1000000 specifically (`projects.id = 1000000`)\n- Verifies the project is configured for AI active context code repositories\n- Ensures proper access permissions and data quality\n\n**Key Filtering Criteria:**\n- **AI Integration**: Must have `state = 10` in `p_ai_active_context_code_repositories` (enabled status)\n- **Active Connection**: Must have an active AI context connection\n- **Access Control**: User ID 1 must have authorization OR project must have public visibility levels (0, 10, 20)\n- **Data Quality**: Project must not be pending deletion or hidden\n\n## Project Context\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace. It's likely used for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query structure indicates this project is actively configured for GitLab's AI features and serves as a controlled environment for testing AI functionality within the GitLab ecosystem.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_fca576c7-2bdf-4cdc-8d3a-ba0c5e5aca30", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace used for testing GitLab Duo features.\n\n## SQL Query Analysis\nThe selected SQL query is designed to retrieve this specific project if it meets AI active context criteria:\n\n**Query Structure:**\n- **Target**: Specifically filters for project ID 1000000\n- **AI Integration**: Joins with `p_ai_active_context_code_repositories` (state = 10, meaning enabled)\n- **Active Connection**: Ensures connection to active AI services via `ai_active_context_connections`\n- **Access Control**: Verifies user authorization (user_id = 1) or public visibility levels\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories\n- Must have an active AI connection\n- Must not be pending deletion or hidden\n- Must be accessible to the requesting user\n\n## Context\nThis test project serves as a controlled environment for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query confirms this project is actively configured for GitLab's AI features and is part of the infrastructure supporting AI-powered development tools.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_12f7d3f4-debb-4cae-9389-22a1079fea53", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace used for testing GitLab Duo features and AI-powered development tools.\n\n## SQL Query Analysis\nThe selected SQL query retrieves this specific project if it meets AI active context criteria:\n\n**Query Structure:**\n- **Target**: Specifically filters for project ID 1000000 (`projects.id = 1000000`)\n- **AI Integration**: Joins with `p_ai_active_context_code_repositories` where `state = 10` (enabled status)\n- **Active Connection**: Ensures connection to active AI services via `ai_active_context_connections`\n- **Access Control**: Verifies user authorization (user_id = 1) or public visibility levels (0, 10, 20)\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories\n- Must have an active AI connection (`active = TRUE`)\n- Must not be pending deletion (`pending_delete = FALSE`)\n- Must not be hidden (`hidden = FALSE`)\n\n## Context\nThis test project serves as a controlled environment for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query confirms this project is actively configured for GitLab's AI features and is part of the infrastructure supporting AI-powered development tools within the GitLab ecosystem.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_d96f3ce1-0513-477c-a825-77a629187fb2", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace used for testing GitLab Duo features and AI-powered development tools.\n\n## SQL Query Analysis\nThe selected SQL query is designed to retrieve this specific project if it meets AI active context criteria:\n\n**Query Structure:**\n- **Target**: Specifically filters for project ID 1000000 (`projects.id = 1000000`)\n- **AI Integration**: Joins with `p_ai_active_context_code_repositories` where `state = 10` (enabled status)\n- **Active Connection**: Ensures connection to active AI services via `ai_active_context_connections`\n- **Access Control**: Verifies user authorization (user_id = 1) or public visibility levels (0, 10, 20)\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories\n- Must have an active AI connection (`active = TRUE`)\n- Must not be pending deletion (`pending_delete = FALSE`)\n- Must not be hidden (`hidden = FALSE`)\n\n## Context\nThis test project serves as a controlled environment for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query confirms this project is actively configured for GitLab's AI features and is part of the infrastructure supporting AI-powered development tools within the GitLab ecosystem. The LIMIT 101 suggests this is likely used for pagination in a user interface displaying AI-enabled projects.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_c826183a-ee2f-49ca-ad89-e6bdbfe481d3", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace used for testing GitLab Duo features and AI-powered development tools.\n\n## SQL Query Analysis\nThe selected SQL query is designed to retrieve this specific project if it meets AI active context criteria:\n\n**Query Structure:**\n- **Target**: Specifically filters for project ID 1000000 (`projects.id = 1000000`)\n- **AI Integration**: Joins with `p_ai_active_context_code_repositories` where `state = 10` (enabled status)\n- **Active Connection**: Ensures connection to active AI services via `ai_active_context_connections`\n- **Access Control**: Verifies user authorization (user_id = 1) or public visibility levels (0, 10, 20)\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories\n- Must have an active AI connection (`active = TRUE`)\n- Must not be pending deletion (`pending_delete = FALSE`)\n- Must not be hidden (`hidden = FALSE`)\n\n## Context\nThis test project serves as a controlled environment for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query confirms this project is actively configured for GitLab's AI features and is part of the infrastructure supporting AI-powered development tools within the GitLab ecosystem. The LIMIT 101 suggests this is likely used for pagination in a user interface displaying AI-enabled projects.\n\nThe project appears to be specifically set up for testing how AI features interact with GitLab repositories and serves as a development sandbox for GitLab's AI capabilities.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/1000000", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Test", +# "secondaryText": "gitlab-duo/test", +# "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", +# "name": "Test", +# "pathWithNamespace": "gitlab-duo/test", +# "description": null +# } +# }, +# { +# "id": "editor_selection:Untitled-2_6edb59f5-3fb5-4706-8374-8e2ca14047f8", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, this is a GitLab project with the following details:\n\n## Project Information\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\n## Project Purpose\nThis appears to be a test project within GitLab's AI development infrastructure, specifically part of the \"gitlab-duo\" namespace used for testing GitLab Duo features and AI-powered development tools.\n\n## SQL Query Analysis\nThe selected SQL query is designed to retrieve this specific project if it meets AI active context criteria:\n\n**Query Structure:**\n- **Target**: Specifically filters for project ID 1000000 (`projects.id = 1000000`)\n- **AI Integration**: Joins with `p_ai_active_context_code_repositories` where `state = 10` (enabled status)\n- **Active Connection**: Ensures connection to active AI services via `ai_active_context_connections`\n- **Access Control**: Verifies user authorization (user_id = 1) or public visibility levels (0, 10, 20)\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories\n- Must have an active AI connection (`active = TRUE`)\n- Must not be pending deletion (`pending_delete = FALSE`)\n- Must not be hidden (`hidden = FALSE`)\n\n## Context\nThis test project serves as a controlled environment for:\n- Testing GitLab Duo Chat functionality\n- Validating AI-powered code assistance features\n- Development and QA of AI context analysis capabilities\n\nThe query confirms this project is actively configured for GitLab's AI features and is part of the infrastructure supporting AI-powered development tools within the GitLab ecosystem. The LIMIT 101 suggests this is likely used for pagination in a user interface displaying AI-enabled projects.\n\nThe project appears to be specifically set up for testing how AI features interact with GitLab repositories and serves as a development sandbox for GitLab's AI capabilities.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/2", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Gitlab Test", +# "secondaryText": "gitlab-org/gitlab-test", +# "webUrl": "http://127.0.0.1:3000/gitlab-org/gitlab-test", +# "name": "Gitlab Test", +# "pathWithNamespace": "gitlab-org/gitlab-test", +# "description": "Fugit omnis laudantium eligendi praesentium commodi unde exercitationem." +# } +# }, +# { +# "id": "editor_selection:Untitled-2_e958c242-2f4b-4126-91e8-7e148878e34f", +# "category": "snippet", +# "content": "SELECT\n projects.*\nFROM\n \"projects\"\n INNER JOIN \"p_ai_active_context_code_repositories\" ON \"p_ai_active_context_code_repositories\".\"state\" = 10\n AND \"p_ai_active_context_code_repositories\".\"project_id\" = \"projects\".\"id\"\n INNER JOIN \"ai_active_context_connections\" \"active_context_connection\" ON \"active_context_connection\".\"id\" = \"p_ai_active_context_code_repositories\".\"connection_id\"\n AND \"active_context_connection\".\"active\" = TRUE\nWHERE (EXISTS (\n SELECT\n 1\n FROM\n \"project_authorizations\"\n WHERE\n \"project_authorizations\".\"user_id\" = 1\n AND (project_authorizations.project_id = projects.id))\n OR projects.visibility_level IN (0, 10, 20))\nAND \"projects\".\"pending_delete\" = FALSE\nAND \"projects\".\"id\" = 1000000\nAND \"projects\".\"hidden\" = FALSE\nORDER BY\n \"projects\".\"id\" DESC\nLIMIT 101", +# "metadata": { +# "title": "Selected text in Untitled-2", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-2", +# "fileName": "Untitled-2" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, there are two projects referenced:\n\n## Primary Project (Referenced in SQL Query)\n- **Name**: Test\n- **Path**: gitlab-duo/test\n- **Project ID**: 1000000\n\nThis is the project specifically targeted by your selected SQL query. It's a test project within GitLab's AI development infrastructure used for testing GitLab Duo features.\n\n## Additional Project Context\n- **Name**: Gitlab Test\n- **Path**: gitlab-org/gitlab-test\n- **Project ID**: 2\n- **Description**: \"Fugit omnis laudantium eligendi praesentium commodi unde exercitationem.\"\n\n## SQL Query Analysis\nYour selected query retrieves project 1000000 (gitlab-duo/test) if it meets these AI active context criteria:\n\n**Key Conditions:**\n- Project must be configured for AI active context code repositories (`state = 10`)\n- Must have an active AI connection (`active = TRUE`)\n- Must be accessible to user ID 1 or have public visibility levels (0, 10, 20)\n- Must not be pending deletion or hidden\n\n**Purpose**: This query confirms that the gitlab-duo/test project is properly configured for GitLab's AI features and serves as a controlled environment for testing AI-powered development tools like GitLab Duo Chat.\n\nThe gitlab-org/gitlab-test project appears to be a separate test repository, possibly used for broader GitLab functionality testing.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "additional_context": [ +# { +# "id": "gid://gitlab/Project/2", +# "category": "repository", +# "content": "", +# "metadata": { +# "enabled": true, +# "disabledReasons": [], +# "subType": "repository", +# "subTypeLabel": "Repository", +# "icon": "project", +# "title": "Gitlab Test", +# "secondaryText": "gitlab-org/gitlab-test", +# "webUrl": "http://127.0.0.1:3000/gitlab-org/gitlab-test", +# "name": "Gitlab Test", +# "pathWithNamespace": "gitlab-org/gitlab-test", +# "description": "Fugit omnis laudantium eligendi praesentium commodi unde exercitationem." +# } +# }, +# { +# "id": "editor_selection:Untitled-3_868c4889-e86c-4301-b457-8bd5545aee28", +# "category": "snippet", +# "content": "curl -X POST \"http://localhost:9200/gitlab_active_context_code_0/_update/3715f782b571c9d90f98bcc1f782d82e5a3cc9909c79d93c16b02585f9c470c2\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"doc\": {\n \"embeddings_v1\": [-0.01508432999253273, 0.015274294652044773, 0.049187272787094116, -0.06840279698371887, 0.012547540478408337, -0.033867403864860535, 0.026312673464417458, -0.017516518011689186, 0.014631485566496849, 0.01420619711279869, -0.05392247065901756, -0.023239463567733765, 0.05422612279653549, -0.05845120549201965, 0.027316024526953697, 0.09630800783634186, 0.08070345222949982, -0.043154023587703705, -0.0034779978450387716, -0.04443162679672241, 0.037512995302677155, -0.03621528297662735, -0.10175580531358719, -0.008218702860176563, 0.01629866473376751, -0.07242297381162643, 0.027508027851581573, 0.006616826169192791, -0.0014285987708717585, -0.005477297119796276, 0.03861776366829872, -0.013913153670728207, 0.05845381319522858, 0.009128240868449211, -0.034828152507543564, 0.0045727030374109745, 0.058525100350379944, -0.006974679417908192, 0.04642173647880554, 0.013150902464985847, -0.03795634210109711, -0.04110471531748772, -0.03995980694890022, -0.057181451469659805, -0.04752727970480919, 0.04135909304022789, -0.013624763116240501, 0.016228940337896347, 0.04999580234289169, -0.005824737716466188, 0.02251339703798294, 0.053839296102523804, -0.02287590317428112, 0.028042830526828766, 0.030783498659729958, 0.04812764748930931, 0.009989951737225056, -0.04026511311531067, -0.009054833091795444, -0.0045867543667554855, -0.02471841126680374, -0.08002601563930511, -0.015011989511549473, -0.007758520543575287, -0.002582667861133814, 0.05805526673793793, 0.03344319015741348, 0.03352123871445656, 0.023127354681491852, -0.02450866997241974, -0.053508784621953964, -0.013684205710887909, 0.027183545753359795, -0.03264005109667778, 0.029970653355121613, 0.008804134093225002, -0.010632060468196869, 0.020277034491300583, -0.022673850879073143, 0.013133982196450233, -0.06818561255931854, 0.044041816145181656, -0.0358954556286335, -0.057511106133461, 0.030537506565451622, 0.01793804205954075, 0.014550188556313515, -0.005379966460168362, -0.023973248898983, -0.012414281256496906, 0.025095466524362564, 0.028870215639472008, -0.058207590132951736, -0.026181470602750778, 0.03645423799753189, 0.02052266336977482, 0.021326228976249695, 0.00954347476363182, -0.026846501976251602, -0.0496688075363636, -0.019610317423939705, 0.0009470809018239379, 0.00540366442874074, -0.038855619728565216, 0.05079306289553642, -0.025347497314214706, -0.027979761362075806, -0.05283702537417412, 0.054664164781570435, 0.0413784384727478, 0.009148655459284782, 0.011428844183683395, -0.04225611314177513, 0.030000343918800354, 0.042161423712968826, -0.015730084851384163, 0.010270730592310429, 0.014482450671494007, -0.05802229419350624, -0.043637242168188095, -0.03603191673755646, -0.058228228241205215, 0.03285786136984825, -0.0004413482383824885, -0.016069721430540085, 0.04568522423505783, -0.034926820546388626, 0.022559603676199913, 0.04484184458851814, -0.02281898446381092, -0.0006233201711438596, -0.06856382638216019, 0.04102805256843567, 0.06238894164562225, 0.049455828964710236, 0.04086413234472275, -0.019492020830512047, -0.025411294773221016, 0.0026857969351112843, 0.07704879343509674, 0.010102342814207077, 0.05306461080908775, -0.02389225736260414, 0.018588358536362648, 0.0476754866540432, -0.049579061567783356, -0.05463515967130661, 0.03710088133811951, 0.028045834973454475, 0.006466677412390709, -0.010212833993136883, 0.0033292719163000584, -0.056212686002254486, 0.06118625029921532, 0.0034992469009011984, -0.01861070841550827, 0.021442728117108345, -0.04488543048501015, -0.012258084490895271, 0.03992530331015587, -0.0015379780670627952, 0.0032348446547985077, -0.048013992607593536, 0.06160783767700195, 0.005712821148335934, 0.03246968612074852, 0.03988546505570412, -0.0657205879688263, -0.049349792301654816, -0.016919029876589775, 0.06742104142904282, -0.0060869245789945126, 0.014880545437335968, 0.02545413002371788, 0.04407207667827606, 0.07300826162099838, -0.018229734152555466, -0.004806406795978546, -0.06016230583190918, -0.05256166309118271, -0.0873689129948616, -0.02502937614917755, 0.020873740315437317, -0.011939841322600842, -0.09576238691806793, 0.007668746169656515, -0.01062703412026167, 0.0124191390350461, -0.07058718055486679, -0.01797851361334324, -0.10042373836040497, -0.02254793979227543, 0.018389064818620682, 0.04763137921690941, -0.030533477663993835, 0.03774100914597511, 0.049618445336818695, 0.03786816447973251, -0.05942686274647713, 0.059405066072940826, -0.05107704550027847, -0.04615524783730507, -0.0061987959779798985, -0.04652858152985573, -0.01751078851521015, -0.018373854458332062, 0.046286117285490036, 0.03109154663980007, 0.007387417834252119, -0.04528384283185005, 0.027378123253583908, -0.007770983502268791, -0.0454661101102829, -0.08659792691469193, -0.03541425243020058, -0.0726311206817627, -0.035393618047237396, -0.024702223017811775, -0.018042443320155144, 0.023425158113241196, -0.012956894002854824, 0.009970043785870075, -0.045796580612659454, 0.02814195118844509, 0.05894787982106209, -0.031509704887866974, 0.06654639542102814, 0.00989073608070612, -0.013253477402031422, 0.008592631667852402, -0.017104962840676308, 0.04531487077474594, -0.0027315295301377773, -0.012990239076316357, 0.032916244119405746, 0.019528482109308243, 0.0033043059520423412, 0.03660107031464577, -0.0321025513112545, -0.013632961548864841, -0.01716376468539238, 0.047902319580316544, -0.06865871697664261, 0.023420412093400955, -0.06075281649827957, 0.0713106095790863, -0.010584399104118347, 0.0501646026968956, -0.12489642202854156, 0.011858572252094746, 0.018492303788661957, -0.005386484786868095, 0.007892888970673084, 0.04216527193784714, 0.08183419704437256, -0.047241512686014175, -0.015162250958383083, 0.049480706453323364, 0.029293743893504143, 0.054022956639528275, 0.026908695697784424, 0.04452517628669739, 0.00954977422952652, -0.03272314742207527, -0.018940730020403862, -0.002257439075037837, -0.06859707832336426, -0.0026491701137274504, 0.02077612467110157, 0.03536425158381462, 0.021410813555121422, 0.0341959148645401, 0.04552409052848816, -0.002164302160963416, -0.03504759445786476, 0.007228975184261799, -0.030892888084053993, -0.04038313403725624, -0.009264233522117138, -0.011113849468529224, -0.004781245719641447, -0.0050904639065265656, 0.05131741985678673, 0.02291041985154152, 0.000452405191026628, -0.02949790470302105, 0.02004089765250683, -0.013605457730591297, 0.015096375718712807, 0.02996094897389412, 0.020922431722283363, 0.01664556935429573, 0.05548161268234253, -0.05493579059839249, -0.009825635701417923, 0.003268016967922449, 0.041642870754003525, 0.03225065395236015, -0.01752147451043129, -0.01113305613398552, -0.004250659607350826, -0.009566985070705414, -0.023192094638943672, 0.01996348798274994, -0.002757037989795208, 0.015359768643975258, -0.0499923974275589, -0.08106652647256851, -0.006640711799263954, 0.03564530611038208, -0.002682725666090846, -0.020712992176413536, 0.06516668200492859, 0.004395897965878248, -0.08645540475845337, 0.026371123269200325, -0.017161408439278603, 0.027523145079612732, -0.006003633141517639, -0.06252996623516083, 0.04590432345867157, -0.032298024743795395, 0.05814722552895546, -0.029753467068076134, -0.008576699532568455, -0.017493557184934616, 0.001251760870218277, -0.017086870968341827, 0.006018348969519138, 0.042785655707120895, 0.030816897749900818, 0.02884254790842533, 0.01751900464296341, 0.00012651791621465236, -0.05657847225666046, -0.02699458971619606, -0.013240436092019081, -0.020685527473688126, 0.020967796444892883, -0.04864560440182686, 0.015841275453567505, -0.00321068218909204, -0.01229917723685503, 0.03088320977985859, -0.029157474637031555, 0.03146807849407196, -0.057267483323812485, -0.004633888136595488, -0.049458589404821396, 0.041066963225603104, -0.01231830008327961, 0.06357453018426895, 0.06467482447624207, 0.018182381987571716, 0.004989755805581808, -0.029756348580121994, -0.0001900894130812958, 0.02027674950659275, 0.0075483666732907295, 0.022817518562078476, -0.011215628124773502, 0.0599694699048996, -0.031766582280397415, -0.0029556865338236094, -0.027268247678875923, 0.006439369171857834, -0.004995699040591717, -0.04129970446228981, 0.012767598032951355, 0.0068725841119885445, 0.015226325020194054, -0.0012194582959637046, 0.0012755049392580986, 0.017128746956586838, 0.013366181403398514, -0.0602792426943779, 0.02261604741215706, 0.019360961392521858, 0.00291081122122705, 0.02607131004333496, -0.06251624971628189, -0.0022200029343366623, -0.040180690586566925, 0.00476752407848835, -0.026818597689270973, 0.05673682317137718, 0.040974754840135574, 0.03733910620212555, 0.038799844682216644, -0.019022725522518158, -0.017288099974393845, 0.05018720030784607, -0.028491126373410225, 0.01830327697098255, -0.022999923676252365, -0.010057097300887108, 0.005191669333726168, 0.000530630350112915, -0.03767064958810806, -0.027619516476988792, 0.03015296719968319, 0.00664415443316102, 0.03166770190000534, -0.04716300219297409, -0.040841322392225266, -0.01842067763209343, -0.07011617720127106, 0.011006759479641914, -0.02215164341032505, -0.04185400530695915, -0.017014095559716225, -0.032787274569272995, -0.016547268256545067, 0.0332382433116436, -0.020872589200735092, -0.05494839698076248, 0.046497661620378494, -0.012227088212966919, -0.004777590278536081, 0.002539602341130376, -0.03182437643408775, 0.10301486402750015, 0.021840037778019905, -0.05471442639827728, 0.010634757578372955, 0.006051914766430855, 0.03819049894809723, 0.01942620798945427, 0.039611585438251495, 0.04640522599220276, -0.022336730733513832, -0.02224213443696499, 0.002470520557835698, -0.01895185001194477, -0.020032064989209175, -0.031154369935393333, 0.0026389528065919876, -0.03044828400015831, 0.027043374255299568, -0.035787004977464676, -0.0041477796621620655, 0.002201845170930028, -0.003109618090093136, 0.01134469173848629, -0.015838565304875374, 0.048045430332422256, -0.07553035765886307, -0.008658398874104023, -0.009064230136573315, 0.11175485700368881, 0.06134338304400444, 0.009891015477478504, -0.03561577945947647, 0.017509356141090393, -0.021974408999085426, 0.03208320215344429, 0.025801783427596092, -0.007452120538800955, 0.04904546961188316, -0.008662826381623745, 0.03113606758415699, -0.004638140555471182, -0.01579095423221588, 0.06820081919431686, 0.055478233844041824, -0.016238883137702942, -0.0069005414843559265, -0.03356923907995224, 0.009719755500555038, 0.01581895910203457, 0.030091021209955215, -0.018349144607782364, -0.05687073618173599, 0.01982325315475464, 0.029767494648694992, 0.05777249112725258, 0.019633203744888306, 0.019874922931194305, -0.009188212454319, -0.002760062925517559, -0.03236094117164612, 0.0052781300619244576, 0.024269329383969307, -0.012582122348248959, -0.046722665429115295, 0.02103022113442421, -0.035037558525800705, -0.031015103682875633, -0.08400914072990417, -0.010492232628166676, -0.036716729402542114, 0.011992587707936764, -0.02135922573506832, -0.10575377196073532, 0.00360663328319788, 0.015804026275873184, 0.014665508642792702, 0.03011547587811947, 0.007580913603305817, -0.03580787777900696, -0.02426774799823761, 0.04891863465309143, -0.06387006491422653, 0.041152361780405045, -0.03490824997425079, 0.001384569564834237, -0.019648391753435135, 0.02632378414273262, -0.005247815977782011, 0.024482514709234238, -0.0682603046298027, 0.014650280587375164, -0.07490735501050949, 0.007454212289303541, 0.013566677458584309, 0.03486083820462227, 0.006869934033602476, -0.015909552574157715, 0.009556359611451626, -0.006615736056119204, -0.03205205872654915, 0.040612079203128815, 0.029044605791568756, 0.008379258215427399, -0.02269962802529335, -0.003665998810902238, 0.010141503065824509, -0.009147735312581062, 0.0627518743276596, 0.02951761521399021, 0.017464783042669296, -0.04135621339082718, -0.10898298770189285, 0.013104535639286041, -0.023110566660761833, 0.004226382821798325, 0.022266289219260216, -0.0006040407461114228, -0.01884135790169239, 0.040645722299814224, 0.003922100644558668, -0.022099779918789864, -0.047207701951265335, -0.06289949268102646, 0.050128765404224396, 0.020683690905570984, -0.0019830530509352684, -0.013286364264786243, -0.02336585707962513, -0.004166312050074339, 0.044237688183784485, 0.05549020692706108, 0.031207360327243805, 0.030022097751498222, -0.0054496414959430695, -0.03429102897644043, -0.0029796280432492495, -0.034374166280031204, -0.0128288259729743, 0.05640212446451187, -0.0028950029518455267, -0.0006897833663970232, -0.013601342216134071, -0.010679077357053757, -0.02097325213253498, -0.0013278340920805931, 0.008968404494225979, 0.06545379012823105, -0.011506274342536926, 0.0010925009846687317, -0.020849309861660004, 0.012062673456966877, -0.052155137062072754, 6.531315739266574e-05, 0.021225400269031525, 0.017183711752295494, -0.06067800521850586, 0.037231724709272385, -0.04324810206890106, 0.02388548105955124, -0.0219861026853323, -0.06712409853935242, 0.06465800106525421, -0.05481339618563652, -0.01023850031197071, -0.028207851573824883, 0.0015749779995530844, -0.050674110651016235, 0.013074646703898907, 0.017029542475938797, 0.012880007736384869, 0.012613309547305107, -0.019306037575006485, 0.02019965648651123, 0.028094299137592316, -0.039234887808561325, -0.021067045629024506, -0.037129491567611694, 0.013188596814870834, -0.047212038189172745, -0.008253740146756172, -0.009587199427187443, -0.0022113872691988945, 0.0191730335354805, 0.0007257199031300843, -0.0616283193230629, -0.003810105612501502, 0.06760333478450775, 0.008961019106209278, 0.02452712692320347, 0.007588340900838375, -0.02201254852116108, -0.007371282204985619, -0.015465701930224895, -0.001015469548292458, 0.009274308569729328, -0.00465518981218338, -0.0596008375287056, -0.021989548578858376, 0.045227523893117905, -0.032461803406476974, -0.038107819855213165, -0.052943889051675797, -0.004647588357329369, 0.025640113279223442, -0.018173210322856903, 0.00035049099824391305, 0.03863126412034035, -0.050701405853033066, 0.050323959439992905, 0.026469899341464043, 0.08013617992401123, -0.034021321684122086, -0.0588218979537487, 0.001710830139927566, -0.0673404261469841, 0.04113754257559776, 0.020344339311122894, -0.00896510761231184, -0.006899771746248007, -0.0374063141644001, -0.04868403077125549, -0.013916170224547386, 0.016279127448797226, 0.038410697132349014, -0.011854824610054493, 0.024435097351670265, 0.009869656525552273, -0.009520918130874634, -0.026783129200339317, 0.011783572845160961, -0.07065480947494507, -0.01845376193523407, 0.02735031768679619, 0.007164307404309511, 0.01699560508131981, 0.07502242922782898, 0.04253268986940384, -0.05969271808862686, 0.015667956322431564, 0.012584367766976357, -0.020805928856134415, -0.04567784443497658, 0.007990032434463501, 0.032740186899900436, -0.0044967904686927795, -0.06956381350755692, -0.010613439604640007, -0.04594683274626732, -0.05907085910439491, -0.02308919094502926, -0.03463181480765343, -0.0027918051928281784, -0.015905747190117836, 0.009687905199825764, 0.03378017246723175, 0.010837909765541553, 0.016862519085407257, -0.013572505675256252, 0.022309066727757454, 0.03044428490102291, 0.011658482253551483, 0.021452395245432854, 0.038573626428842545, 0.03796909749507904, -0.01567072793841362, 0.03756283223628998, 0.051227882504463196, -0.0033551387023180723, 0.042494628578424454, 0.006709746550768614, 0.015420020557940006, -0.03267405182123184, -0.021763181313872337, -0.012528805993497372, -0.030517788603901863, 0.00590492133051157, 0.013119252398610115, 0.011033006012439728, -0.005199330393224955, -0.006823177449405193, 0.0071070194244384766, 0.09850434213876724, 0.02136453427374363, 0.04575536027550697, -0.004130864981561899, 0.004952211864292622, -0.006301517598330975, -0.015446100383996964, 0.012485417537391186, 0.017320558428764343, -0.0027096469420939684, 0.0035560019314289093, 0.017782587558031082, -0.024555722251534462, -0.027663061395287514, 0.011464798822999, 0.04391603544354439, 0.030104340985417366, -0.01941314898431301, 0.09129959344863892, -0.08229165524244308, -0.023429732769727707, 0.02858392894268036, 0.03228788822889328, -0.02159786783158779, -0.022941796109080315, -0.0009915597038343549, -0.008010897785425186, -0.028077179566025734, -0.028530199080705643, -0.030626952648162842, 0.012862630188465118, -0.027988065034151077, 0.027100762352347374, 0.0008189414511434734, -0.11926709860563278, -0.02552659809589386, -0.015098984353244305, 0.013741358183324337, 0.009513750672340393, 0.031119083985686302, 0.0017531360499560833, 0.012504946440458298, 0.00257395813241601, -0.004865455906838179, -0.009541905485093594, 0.09122291952371597, -0.05252096429467201, 0.06027059257030487, -0.04163514822721481, 0.009317437186837196, -0.0053072404116392136, 0.00532691041007638, -0.0207924023270607, 0.0798245519399643, -0.0038600650150328875, 0.012915478087961674, 0.024653354659676552, -0.055835459381341934, 0.06553937494754791, 0.03494492918252945, -0.002789985155686736, 0.06104496121406555, 0.007434958126395941, 0.03410299867391586, 0.0050359442830085754, -0.02983841858804226]\n }\n }'", +# "metadata": { +# "title": "Selected text in Untitled-3", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-3", +# "fileName": "Untitled-3" +# } +# } +# ], +# "agent_scratchpad": null +# }, +# { +# "role": "assistant", +# "content": "Based on the context provided, I can see information about the **Gitlab Test** project:\n\n## Project Information\n- **Name**: Gitlab Test\n- **Path**: gitlab-org/gitlab-test\n- **Project ID**: 2\n- **Description**: \"Fugit omnis laudantium eligendi praesentium commodi unde exercitationem.\"\n\n## Project Content\nThe project appears to contain at least one file:\n- `encoding/hotfix-1.txt` with content \"Hotfix 1\"\n\n## Technical Context\nThe selected curl command shows an Elasticsearch operation that's updating embeddings for this project:\n\n**Purpose**: Updates vector embeddings (embeddings_v1) in an Elasticsearch index\n- **Index**: `gitlab_active_context_code_0`\n- **Document ID**: `3715f782b571c9d90f98bcc1f782d82e5a3cc9909c79d93c16b02585f9c470c2`\n- **Operation**: Updates a document with a 1024-dimensional embedding vector\n\n**AI Integration**: This appears to be part of GitLab's AI active context system, where code embeddings are stored in Elasticsearch to enable:\n- Semantic code search\n- AI-powered code suggestions\n- Context-aware responses in GitLab Duo Chat\n\nThe gitlab-org/gitlab-test project seems to be a test repository used by GitLab for testing various features, including AI-powered code analysis and embedding generation. The embeddings are likely generated from the project's code content to support AI features.", +# "additional_context": null, +# "agent_scratchpad": [] +# }, +# { +# "role": "user", +# "content": "could you describe this project?", +# "context": null, +# "current_file": { +# "file_path": "Untitled-3", +# "data": "curl -X POST \"http://localhost:9200/gitlab_active_context_code_0/_update/3715f782b571c9d90f98bcc1f782d82e5a3cc9909c79d93c16b02585f9c470c2\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"doc\": {\n \"embeddings_v1\": [-0.01508432999253273, 0.015274294652044773, 0.049187272787094116, -0.06840279698371887, 0.012547540478408337, -0.033867403864860535, 0.026312673464417458, -0.017516518011689186, 0.014631485566496849, 0.01420619711279869, -0.05392247065901756, -0.023239463567733765, 0.05422612279653549, -0.05845120549201965, 0.027316024526953697, 0.09630800783634186, 0.08070345222949982, -0.043154023587703705, -0.0034779978450387716, -0.04443162679672241, 0.037512995302677155, -0.03621528297662735, -0.10175580531358719, -0.008218702860176563, 0.01629866473376751, -0.07242297381162643, 0.027508027851581573, 0.006616826169192791, -0.0014285987708717585, -0.005477297119796276, 0.03861776366829872, -0.013913153670728207, 0.05845381319522858, 0.009128240868449211, -0.034828152507543564, 0.0045727030374109745, 0.058525100350379944, -0.006974679417908192, 0.04642173647880554, 0.013150902464985847, -0.03795634210109711, -0.04110471531748772, -0.03995980694890022, -0.057181451469659805, -0.04752727970480919, 0.04135909304022789, -0.013624763116240501, 0.016228940337896347, 0.04999580234289169, -0.005824737716466188, 0.02251339703798294, 0.053839296102523804, -0.02287590317428112, 0.028042830526828766, 0.030783498659729958, 0.04812764748930931, 0.009989951737225056, -0.04026511311531067, -0.009054833091795444, -0.0045867543667554855, -0.02471841126680374, -0.08002601563930511, -0.015011989511549473, -0.007758520543575287, -0.002582667861133814, 0.05805526673793793, 0.03344319015741348, 0.03352123871445656, 0.023127354681491852, -0.02450866997241974, -0.053508784621953964, -0.013684205710887909, 0.027183545753359795, -0.03264005109667778, 0.029970653355121613, 0.008804134093225002, -0.010632060468196869, 0.020277034491300583, -0.022673850879073143, 0.013133982196450233, -0.06818561255931854, 0.044041816145181656, -0.0358954556286335, -0.057511106133461, 0.030537506565451622, 0.01793804205954075, 0.014550188556313515, -0.005379966460168362, -0.023973248898983, -0.012414281256496906, 0.025095466524362564, 0.028870215639472008, -0.058207590132951736, -0.026181470602750778, 0.03645423799753189, 0.02052266336977482, 0.021326228976249695, 0.00954347476363182, -0.026846501976251602, -0.0496688075363636, -0.019610317423939705, 0.0009470809018239379, 0.00540366442874074, -0.038855619728565216, 0.05079306289553642, -0.025347497314214706, -0.027979761362075806, -0.05283702537417412, 0.054664164781570435, 0.0413784384727478, 0.009148655459284782, 0.011428844183683395, -0.04225611314177513, 0.030000343918800354, 0.042161423712968826, -0.015730084851384163, 0.010270730592310429, 0.014482450671494007, -0.05802229419350624, -0.043637242168188095, -0.03603191673755646, -0.058228228241205215, 0.03285786136984825, -0.0004413482383824885, -0.016069721430540085, 0.04568522423505783, -0.034926820546388626, 0.022559603676199913, 0.04484184458851814, -0.02281898446381092, -0.0006233201711438596, -0.06856382638216019, 0.04102805256843567, 0.06238894164562225, 0.049455828964710236, 0.04086413234472275, -0.019492020830512047, -0.025411294773221016, 0.0026857969351112843, 0.07704879343509674, 0.010102342814207077, 0.05306461080908775, -0.02389225736260414, 0.018588358536362648, 0.0476754866540432, -0.049579061567783356, -0.05463515967130661, 0.03710088133811951, 0.028045834973454475, 0.006466677412390709, -0.010212833993136883, 0.0033292719163000584, -0.056212686002254486, 0.06118625029921532, 0.0034992469009011984, -0.01861070841550827, 0.021442728117108345, -0.04488543048501015, -0.012258084490895271, 0.03992530331015587, -0.0015379780670627952, 0.0032348446547985077, -0.048013992607593536, 0.06160783767700195, 0.005712821148335934, 0.03246968612074852, 0.03988546505570412, -0.0657205879688263, -0.049349792301654816, -0.016919029876589775, 0.06742104142904282, -0.0060869245789945126, 0.014880545437335968, 0.02545413002371788, 0.04407207667827606, 0.07300826162099838, -0.018229734152555466, -0.004806406795978546, -0.06016230583190918, -0.05256166309118271, -0.0873689129948616, -0.02502937614917755, 0.020873740315437317, -0.011939841322600842, -0.09576238691806793, 0.007668746169656515, -0.01062703412026167, 0.0124191390350461, -0.07058718055486679, -0.01797851361334324, -0.10042373836040497, -0.02254793979227543, 0.018389064818620682, 0.04763137921690941, -0.030533477663993835, 0.03774100914597511, 0.049618445336818695, 0.03786816447973251, -0.05942686274647713, 0.059405066072940826, -0.05107704550027847, -0.04615524783730507, -0.0061987959779798985, -0.04652858152985573, -0.01751078851521015, -0.018373854458332062, 0.046286117285490036, 0.03109154663980007, 0.007387417834252119, -0.04528384283185005, 0.027378123253583908, -0.007770983502268791, -0.0454661101102829, -0.08659792691469193, -0.03541425243020058, -0.0726311206817627, -0.035393618047237396, -0.024702223017811775, -0.018042443320155144, 0.023425158113241196, -0.012956894002854824, 0.009970043785870075, -0.045796580612659454, 0.02814195118844509, 0.05894787982106209, -0.031509704887866974, 0.06654639542102814, 0.00989073608070612, -0.013253477402031422, 0.008592631667852402, -0.017104962840676308, 0.04531487077474594, -0.0027315295301377773, -0.012990239076316357, 0.032916244119405746, 0.019528482109308243, 0.0033043059520423412, 0.03660107031464577, -0.0321025513112545, -0.013632961548864841, -0.01716376468539238, 0.047902319580316544, -0.06865871697664261, 0.023420412093400955, -0.06075281649827957, 0.0713106095790863, -0.010584399104118347, 0.0501646026968956, -0.12489642202854156, 0.011858572252094746, 0.018492303788661957, -0.005386484786868095, 0.007892888970673084, 0.04216527193784714, 0.08183419704437256, -0.047241512686014175, -0.015162250958383083, 0.049480706453323364, 0.029293743893504143, 0.054022956639528275, 0.026908695697784424, 0.04452517628669739, 0.00954977422952652, -0.03272314742207527, -0.018940730020403862, -0.002257439075037837, -0.06859707832336426, -0.0026491701137274504, 0.02077612467110157, 0.03536425158381462, 0.021410813555121422, 0.0341959148645401, 0.04552409052848816, -0.002164302160963416, -0.03504759445786476, 0.007228975184261799, -0.030892888084053993, -0.04038313403725624, -0.009264233522117138, -0.011113849468529224, -0.004781245719641447, -0.0050904639065265656, 0.05131741985678673, 0.02291041985154152, 0.000452405191026628, -0.02949790470302105, 0.02004089765250683, -0.013605457730591297, 0.015096375718712807, 0.02996094897389412, 0.020922431722283363, 0.01664556935429573, 0.05548161268234253, -0.05493579059839249, -0.009825635701417923, 0.003268016967922449, 0.041642870754003525, 0.03225065395236015, -0.01752147451043129, -0.01113305613398552, -0.004250659607350826, -0.009566985070705414, -0.023192094638943672, 0.01996348798274994, -0.002757037989795208, 0.015359768643975258, -0.0499923974275589, -0.08106652647256851, -0.006640711799263954, 0.03564530611038208, -0.002682725666090846, -0.020712992176413536, 0.06516668200492859, 0.004395897965878248, -0.08645540475845337, 0.026371123269200325, -0.017161408439278603, 0.027523145079612732, -0.006003633141517639, -0.06252996623516083, 0.04590432345867157, -0.032298024743795395, 0.05814722552895546, -0.029753467068076134, -0.008576699532568455, -0.017493557184934616, 0.001251760870218277, -0.017086870968341827, 0.006018348969519138, 0.042785655707120895, 0.030816897749900818, 0.02884254790842533, 0.01751900464296341, 0.00012651791621465236, -0.05657847225666046, -0.02699458971619606, -0.013240436092019081, -0.020685527473688126, 0.020967796444892883, -0.04864560440182686, 0.015841275453567505, -0.00321068218909204, -0.01229917723685503, 0.03088320977985859, -0.029157474637031555, 0.03146807849407196, -0.057267483323812485, -0.004633888136595488, -0.049458589404821396, 0.041066963225603104, -0.01231830008327961, 0.06357453018426895, 0.06467482447624207, 0.018182381987571716, 0.004989755805581808, -0.029756348580121994, -0.0001900894130812958, 0.02027674950659275, 0.0075483666732907295, 0.022817518562078476, -0.011215628124773502, 0.0599694699048996, -0.031766582280397415, -0.0029556865338236094, -0.027268247678875923, 0.006439369171857834, -0.004995699040591717, -0.04129970446228981, 0.012767598032951355, 0.0068725841119885445, 0.015226325020194054, -0.0012194582959637046, 0.0012755049392580986, 0.017128746956586838, 0.013366181403398514, -0.0602792426943779, 0.02261604741215706, 0.019360961392521858, 0.00291081122122705, 0.02607131004333496, -0.06251624971628189, -0.0022200029343366623, -0.040180690586566925, 0.00476752407848835, -0.026818597689270973, 0.05673682317137718, 0.040974754840135574, 0.03733910620212555, 0.038799844682216644, -0.019022725522518158, -0.017288099974393845, 0.05018720030784607, -0.028491126373410225, 0.01830327697098255, -0.022999923676252365, -0.010057097300887108, 0.005191669333726168, 0.000530630350112915, -0.03767064958810806, -0.027619516476988792, 0.03015296719968319, 0.00664415443316102, 0.03166770190000534, -0.04716300219297409, -0.040841322392225266, -0.01842067763209343, -0.07011617720127106, 0.011006759479641914, -0.02215164341032505, -0.04185400530695915, -0.017014095559716225, -0.032787274569272995, -0.016547268256545067, 0.0332382433116436, -0.020872589200735092, -0.05494839698076248, 0.046497661620378494, -0.012227088212966919, -0.004777590278536081, 0.002539602341130376, -0.03182437643408775, 0.10301486402750015, 0.021840037778019905, -0.05471442639827728, 0.010634757578372955, 0.006051914766430855, 0.03819049894809723, 0.01942620798945427, 0.039611585438251495, 0.04640522599220276, -0.022336730733513832, -0.02224213443696499, 0.002470520557835698, -0.01895185001194477, -0.020032064989209175, -0.031154369935393333, 0.0026389528065919876, -0.03044828400015831, 0.027043374255299568, -0.035787004977464676, -0.0041477796621620655, 0.002201845170930028, -0.003109618090093136, 0.01134469173848629, -0.015838565304875374, 0.048045430332422256, -0.07553035765886307, -0.008658398874104023, -0.009064230136573315, 0.11175485700368881, 0.06134338304400444, 0.009891015477478504, -0.03561577945947647, 0.017509356141090393, -0.021974408999085426, 0.03208320215344429, 0.025801783427596092, -0.007452120538800955, 0.04904546961188316, -0.008662826381623745, 0.03113606758415699, -0.004638140555471182, -0.01579095423221588, 0.06820081919431686, 0.055478233844041824, -0.016238883137702942, -0.0069005414843559265, -0.03356923907995224, 0.009719755500555038, 0.01581895910203457, 0.030091021209955215, -0.018349144607782364, -0.05687073618173599, 0.01982325315475464, 0.029767494648694992, 0.05777249112725258, 0.019633203744888306, 0.019874922931194305, -0.009188212454319, -0.002760062925517559, -0.03236094117164612, 0.0052781300619244576, 0.024269329383969307, -0.012582122348248959, -0.046722665429115295, 0.02103022113442421, -0.035037558525800705, -0.031015103682875633, -0.08400914072990417, -0.010492232628166676, -0.036716729402542114, 0.011992587707936764, -0.02135922573506832, -0.10575377196073532, 0.00360663328319788, 0.015804026275873184, 0.014665508642792702, 0.03011547587811947, 0.007580913603305817, -0.03580787777900696, -0.02426774799823761, 0.04891863465309143, -0.06387006491422653, 0.041152361780405045, -0.03490824997425079, 0.001384569564834237, -0.019648391753435135, 0.02632378414273262, -0.005247815977782011, 0.024482514709234238, -0.0682603046298027, 0.014650280587375164, -0.07490735501050949, 0.007454212289303541, 0.013566677458584309, 0.03486083820462227, 0.006869934033602476, -0.015909552574157715, 0.009556359611451626, -0.006615736056119204, -0.03205205872654915, 0.040612079203128815, 0.029044605791568756, 0.008379258215427399, -0.02269962802529335, -0.003665998810902238, 0.010141503065824509, -0.009147735312581062, 0.0627518743276596, 0.02951761521399021, 0.017464783042669296, -0.04135621339082718, -0.10898298770189285, 0.013104535639286041, -0.023110566660761833, 0.004226382821798325, 0.022266289219260216, -0.0006040407461114228, -0.01884135790169239, 0.040645722299814224, 0.003922100644558668, -0.022099779918789864, -0.047207701951265335, -0.06289949268102646, 0.050128765404224396, 0.020683690905570984, -0.0019830530509352684, -0.013286364264786243, -0.02336585707962513, -0.004166312050074339, 0.044237688183784485, 0.05549020692706108, 0.031207360327243805, 0.030022097751498222, -0.0054496414959430695, -0.03429102897644043, -0.0029796280432492495, -0.034374166280031204, -0.0128288259729743, 0.05640212446451187, -0.0028950029518455267, -0.0006897833663970232, -0.013601342216134071, -0.010679077357053757, -0.02097325213253498, -0.0013278340920805931, 0.008968404494225979, 0.06545379012823105, -0.011506274342536926, 0.0010925009846687317, -0.020849309861660004, 0.012062673456966877, -0.052155137062072754, 6.531315739266574e-05, 0.021225400269031525, 0.017183711752295494, -0.06067800521850586, 0.037231724709272385, -0.04324810206890106, 0.02388548105955124, -0.0219861026853323, -0.06712409853935242, 0.06465800106525421, -0.05481339618563652, -0.01023850031197071, -0.028207851573824883, 0.0015749779995530844, -0.050674110651016235, 0.013074646703898907, 0.017029542475938797, 0.012880007736384869, 0.012613309547305107, -0.019306037575006485, 0.02019965648651123, 0.028094299137592316, -0.039234887808561325, -0.021067045629024506, -0.037129491567611694, 0.013188596814870834, -0.047212038189172745, -0.008253740146756172, -0.009587199427187443, -0.0022113872691988945, 0.0191730335354805, 0.0007257199031300843, -0.0616283193230629, -0.003810105612501502, 0.06760333478450775, 0.008961019106209278, 0.02452712692320347, 0.007588340900838375, -0.02201254852116108, -0.007371282204985619, -0.015465701930224895, -0.001015469548292458, 0.009274308569729328, -0.00465518981218338, -0.0596008375287056, -0.021989548578858376, 0.045227523893117905, -0.032461803406476974, -0.038107819855213165, -0.052943889051675797, -0.004647588357329369, 0.025640113279223442, -0.018173210322856903, 0.00035049099824391305, 0.03863126412034035, -0.050701405853033066, 0.050323959439992905, 0.026469899341464043, 0.08013617992401123, -0.034021321684122086, -0.0588218979537487, 0.001710830139927566, -0.0673404261469841, 0.04113754257559776, 0.020344339311122894, -0.00896510761231184, -0.006899771746248007, -0.0374063141644001, -0.04868403077125549, -0.013916170224547386, 0.016279127448797226, 0.038410697132349014, -0.011854824610054493, 0.024435097351670265, 0.009869656525552273, -0.009520918130874634, -0.026783129200339317, 0.011783572845160961, -0.07065480947494507, -0.01845376193523407, 0.02735031768679619, 0.007164307404309511, 0.01699560508131981, 0.07502242922782898, 0.04253268986940384, -0.05969271808862686, 0.015667956322431564, 0.012584367766976357, -0.020805928856134415, -0.04567784443497658, 0.007990032434463501, 0.032740186899900436, -0.0044967904686927795, -0.06956381350755692, -0.010613439604640007, -0.04594683274626732, -0.05907085910439491, -0.02308919094502926, -0.03463181480765343, -0.0027918051928281784, -0.015905747190117836, 0.009687905199825764, 0.03378017246723175, 0.010837909765541553, 0.016862519085407257, -0.013572505675256252, 0.022309066727757454, 0.03044428490102291, 0.011658482253551483, 0.021452395245432854, 0.038573626428842545, 0.03796909749507904, -0.01567072793841362, 0.03756283223628998, 0.051227882504463196, -0.0033551387023180723, 0.042494628578424454, 0.006709746550768614, 0.015420020557940006, -0.03267405182123184, -0.021763181313872337, -0.012528805993497372, -0.030517788603901863, 0.00590492133051157, 0.013119252398610115, 0.011033006012439728, -0.005199330393224955, -0.006823177449405193, 0.0071070194244384766, 0.09850434213876724, 0.02136453427374363, 0.04575536027550697, -0.004130864981561899, 0.004952211864292622, -0.006301517598330975, -0.015446100383996964, 0.012485417537391186, 0.017320558428764343, -0.0027096469420939684, 0.0035560019314289093, 0.017782587558031082, -0.024555722251534462, -0.027663061395287514, 0.011464798822999, 0.04391603544354439, 0.030104340985417366, -0.01941314898431301, 0.09129959344863892, -0.08229165524244308, -0.023429732769727707, 0.02858392894268036, 0.03228788822889328, -0.02159786783158779, -0.022941796109080315, -0.0009915597038343549, -0.008010897785425186, -0.028077179566025734, -0.028530199080705643, -0.030626952648162842, 0.012862630188465118, -0.027988065034151077, 0.027100762352347374, 0.0008189414511434734, -0.11926709860563278, -0.02552659809589386, -0.015098984353244305, 0.013741358183324337, 0.009513750672340393, 0.031119083985686302, 0.0017531360499560833, 0.012504946440458298, 0.00257395813241601, -0.004865455906838179, -0.009541905485093594, 0.09122291952371597, -0.05252096429467201, 0.06027059257030487, -0.04163514822721481, 0.009317437186837196, -0.0053072404116392136, 0.00532691041007638, -0.0207924023270607, 0.0798245519399643, -0.0038600650150328875, 0.012915478087961674, 0.024653354659676552, -0.055835459381341934, 0.06553937494754791, 0.03494492918252945, -0.002789985155686736, 0.06104496121406555, 0.007434958126395941, 0.03410299867391586, 0.0050359442830085754, -0.02983841858804226]\n }\n }'", +# "selected_code": true +# }, +# "additional_context": [ +# { +# "id": "editor_selection:Untitled-3_036d11aa-c22b-423b-8764-d33fc77f90c7", +# "category": "snippet", +# "content": "curl -X POST \"http://localhost:9200/gitlab_active_context_code_0/_update/3715f782b571c9d90f98bcc1f782d82e5a3cc9909c79d93c16b02585f9c470c2\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"doc\": {\n \"embeddings_v1\": [-0.01508432999253273, 0.015274294652044773, 0.049187272787094116, -0.06840279698371887, 0.012547540478408337, -0.033867403864860535, 0.026312673464417458, -0.017516518011689186, 0.014631485566496849, 0.01420619711279869, -0.05392247065901756, -0.023239463567733765, 0.05422612279653549, -0.05845120549201965, 0.027316024526953697, 0.09630800783634186, 0.08070345222949982, -0.043154023587703705, -0.0034779978450387716, -0.04443162679672241, 0.037512995302677155, -0.03621528297662735, -0.10175580531358719, -0.008218702860176563, 0.01629866473376751, -0.07242297381162643, 0.027508027851581573, 0.006616826169192791, -0.0014285987708717585, -0.005477297119796276, 0.03861776366829872, -0.013913153670728207, 0.05845381319522858, 0.009128240868449211, -0.034828152507543564, 0.0045727030374109745, 0.058525100350379944, -0.006974679417908192, 0.04642173647880554, 0.013150902464985847, -0.03795634210109711, -0.04110471531748772, -0.03995980694890022, -0.057181451469659805, -0.04752727970480919, 0.04135909304022789, -0.013624763116240501, 0.016228940337896347, 0.04999580234289169, -0.005824737716466188, 0.02251339703798294, 0.053839296102523804, -0.02287590317428112, 0.028042830526828766, 0.030783498659729958, 0.04812764748930931, 0.009989951737225056, -0.04026511311531067, -0.009054833091795444, -0.0045867543667554855, -0.02471841126680374, -0.08002601563930511, -0.015011989511549473, -0.007758520543575287, -0.002582667861133814, 0.05805526673793793, 0.03344319015741348, 0.03352123871445656, 0.023127354681491852, -0.02450866997241974, -0.053508784621953964, -0.013684205710887909, 0.027183545753359795, -0.03264005109667778, 0.029970653355121613, 0.008804134093225002, -0.010632060468196869, 0.020277034491300583, -0.022673850879073143, 0.013133982196450233, -0.06818561255931854, 0.044041816145181656, -0.0358954556286335, -0.057511106133461, 0.030537506565451622, 0.01793804205954075, 0.014550188556313515, -0.005379966460168362, -0.023973248898983, -0.012414281256496906, 0.025095466524362564, 0.028870215639472008, -0.058207590132951736, -0.026181470602750778, 0.03645423799753189, 0.02052266336977482, 0.021326228976249695, 0.00954347476363182, -0.026846501976251602, -0.0496688075363636, -0.019610317423939705, 0.0009470809018239379, 0.00540366442874074, -0.038855619728565216, 0.05079306289553642, -0.025347497314214706, -0.027979761362075806, -0.05283702537417412, 0.054664164781570435, 0.0413784384727478, 0.009148655459284782, 0.011428844183683395, -0.04225611314177513, 0.030000343918800354, 0.042161423712968826, -0.015730084851384163, 0.010270730592310429, 0.014482450671494007, -0.05802229419350624, -0.043637242168188095, -0.03603191673755646, -0.058228228241205215, 0.03285786136984825, -0.0004413482383824885, -0.016069721430540085, 0.04568522423505783, -0.034926820546388626, 0.022559603676199913, 0.04484184458851814, -0.02281898446381092, -0.0006233201711438596, -0.06856382638216019, 0.04102805256843567, 0.06238894164562225, 0.049455828964710236, 0.04086413234472275, -0.019492020830512047, -0.025411294773221016, 0.0026857969351112843, 0.07704879343509674, 0.010102342814207077, 0.05306461080908775, -0.02389225736260414, 0.018588358536362648, 0.0476754866540432, -0.049579061567783356, -0.05463515967130661, 0.03710088133811951, 0.028045834973454475, 0.006466677412390709, -0.010212833993136883, 0.0033292719163000584, -0.056212686002254486, 0.06118625029921532, 0.0034992469009011984, -0.01861070841550827, 0.021442728117108345, -0.04488543048501015, -0.012258084490895271, 0.03992530331015587, -0.0015379780670627952, 0.0032348446547985077, -0.048013992607593536, 0.06160783767700195, 0.005712821148335934, 0.03246968612074852, 0.03988546505570412, -0.0657205879688263, -0.049349792301654816, -0.016919029876589775, 0.06742104142904282, -0.0060869245789945126, 0.014880545437335968, 0.02545413002371788, 0.04407207667827606, 0.07300826162099838, -0.018229734152555466, -0.004806406795978546, -0.06016230583190918, -0.05256166309118271, -0.0873689129948616, -0.02502937614917755, 0.020873740315437317, -0.011939841322600842, -0.09576238691806793, 0.007668746169656515, -0.01062703412026167, 0.0124191390350461, -0.07058718055486679, -0.01797851361334324, -0.10042373836040497, -0.02254793979227543, 0.018389064818620682, 0.04763137921690941, -0.030533477663993835, 0.03774100914597511, 0.049618445336818695, 0.03786816447973251, -0.05942686274647713, 0.059405066072940826, -0.05107704550027847, -0.04615524783730507, -0.0061987959779798985, -0.04652858152985573, -0.01751078851521015, -0.018373854458332062, 0.046286117285490036, 0.03109154663980007, 0.007387417834252119, -0.04528384283185005, 0.027378123253583908, -0.007770983502268791, -0.0454661101102829, -0.08659792691469193, -0.03541425243020058, -0.0726311206817627, -0.035393618047237396, -0.024702223017811775, -0.018042443320155144, 0.023425158113241196, -0.012956894002854824, 0.009970043785870075, -0.045796580612659454, 0.02814195118844509, 0.05894787982106209, -0.031509704887866974, 0.06654639542102814, 0.00989073608070612, -0.013253477402031422, 0.008592631667852402, -0.017104962840676308, 0.04531487077474594, -0.0027315295301377773, -0.012990239076316357, 0.032916244119405746, 0.019528482109308243, 0.0033043059520423412, 0.03660107031464577, -0.0321025513112545, -0.013632961548864841, -0.01716376468539238, 0.047902319580316544, -0.06865871697664261, 0.023420412093400955, -0.06075281649827957, 0.0713106095790863, -0.010584399104118347, 0.0501646026968956, -0.12489642202854156, 0.011858572252094746, 0.018492303788661957, -0.005386484786868095, 0.007892888970673084, 0.04216527193784714, 0.08183419704437256, -0.047241512686014175, -0.015162250958383083, 0.049480706453323364, 0.029293743893504143, 0.054022956639528275, 0.026908695697784424, 0.04452517628669739, 0.00954977422952652, -0.03272314742207527, -0.018940730020403862, -0.002257439075037837, -0.06859707832336426, -0.0026491701137274504, 0.02077612467110157, 0.03536425158381462, 0.021410813555121422, 0.0341959148645401, 0.04552409052848816, -0.002164302160963416, -0.03504759445786476, 0.007228975184261799, -0.030892888084053993, -0.04038313403725624, -0.009264233522117138, -0.011113849468529224, -0.004781245719641447, -0.0050904639065265656, 0.05131741985678673, 0.02291041985154152, 0.000452405191026628, -0.02949790470302105, 0.02004089765250683, -0.013605457730591297, 0.015096375718712807, 0.02996094897389412, 0.020922431722283363, 0.01664556935429573, 0.05548161268234253, -0.05493579059839249, -0.009825635701417923, 0.003268016967922449, 0.041642870754003525, 0.03225065395236015, -0.01752147451043129, -0.01113305613398552, -0.004250659607350826, -0.009566985070705414, -0.023192094638943672, 0.01996348798274994, -0.002757037989795208, 0.015359768643975258, -0.0499923974275589, -0.08106652647256851, -0.006640711799263954, 0.03564530611038208, -0.002682725666090846, -0.020712992176413536, 0.06516668200492859, 0.004395897965878248, -0.08645540475845337, 0.026371123269200325, -0.017161408439278603, 0.027523145079612732, -0.006003633141517639, -0.06252996623516083, 0.04590432345867157, -0.032298024743795395, 0.05814722552895546, -0.029753467068076134, -0.008576699532568455, -0.017493557184934616, 0.001251760870218277, -0.017086870968341827, 0.006018348969519138, 0.042785655707120895, 0.030816897749900818, 0.02884254790842533, 0.01751900464296341, 0.00012651791621465236, -0.05657847225666046, -0.02699458971619606, -0.013240436092019081, -0.020685527473688126, 0.020967796444892883, -0.04864560440182686, 0.015841275453567505, -0.00321068218909204, -0.01229917723685503, 0.03088320977985859, -0.029157474637031555, 0.03146807849407196, -0.057267483323812485, -0.004633888136595488, -0.049458589404821396, 0.041066963225603104, -0.01231830008327961, 0.06357453018426895, 0.06467482447624207, 0.018182381987571716, 0.004989755805581808, -0.029756348580121994, -0.0001900894130812958, 0.02027674950659275, 0.0075483666732907295, 0.022817518562078476, -0.011215628124773502, 0.0599694699048996, -0.031766582280397415, -0.0029556865338236094, -0.027268247678875923, 0.006439369171857834, -0.004995699040591717, -0.04129970446228981, 0.012767598032951355, 0.0068725841119885445, 0.015226325020194054, -0.0012194582959637046, 0.0012755049392580986, 0.017128746956586838, 0.013366181403398514, -0.0602792426943779, 0.02261604741215706, 0.019360961392521858, 0.00291081122122705, 0.02607131004333496, -0.06251624971628189, -0.0022200029343366623, -0.040180690586566925, 0.00476752407848835, -0.026818597689270973, 0.05673682317137718, 0.040974754840135574, 0.03733910620212555, 0.038799844682216644, -0.019022725522518158, -0.017288099974393845, 0.05018720030784607, -0.028491126373410225, 0.01830327697098255, -0.022999923676252365, -0.010057097300887108, 0.005191669333726168, 0.000530630350112915, -0.03767064958810806, -0.027619516476988792, 0.03015296719968319, 0.00664415443316102, 0.03166770190000534, -0.04716300219297409, -0.040841322392225266, -0.01842067763209343, -0.07011617720127106, 0.011006759479641914, -0.02215164341032505, -0.04185400530695915, -0.017014095559716225, -0.032787274569272995, -0.016547268256545067, 0.0332382433116436, -0.020872589200735092, -0.05494839698076248, 0.046497661620378494, -0.012227088212966919, -0.004777590278536081, 0.002539602341130376, -0.03182437643408775, 0.10301486402750015, 0.021840037778019905, -0.05471442639827728, 0.010634757578372955, 0.006051914766430855, 0.03819049894809723, 0.01942620798945427, 0.039611585438251495, 0.04640522599220276, -0.022336730733513832, -0.02224213443696499, 0.002470520557835698, -0.01895185001194477, -0.020032064989209175, -0.031154369935393333, 0.0026389528065919876, -0.03044828400015831, 0.027043374255299568, -0.035787004977464676, -0.0041477796621620655, 0.002201845170930028, -0.003109618090093136, 0.01134469173848629, -0.015838565304875374, 0.048045430332422256, -0.07553035765886307, -0.008658398874104023, -0.009064230136573315, 0.11175485700368881, 0.06134338304400444, 0.009891015477478504, -0.03561577945947647, 0.017509356141090393, -0.021974408999085426, 0.03208320215344429, 0.025801783427596092, -0.007452120538800955, 0.04904546961188316, -0.008662826381623745, 0.03113606758415699, -0.004638140555471182, -0.01579095423221588, 0.06820081919431686, 0.055478233844041824, -0.016238883137702942, -0.0069005414843559265, -0.03356923907995224, 0.009719755500555038, 0.01581895910203457, 0.030091021209955215, -0.018349144607782364, -0.05687073618173599, 0.01982325315475464, 0.029767494648694992, 0.05777249112725258, 0.019633203744888306, 0.019874922931194305, -0.009188212454319, -0.002760062925517559, -0.03236094117164612, 0.0052781300619244576, 0.024269329383969307, -0.012582122348248959, -0.046722665429115295, 0.02103022113442421, -0.035037558525800705, -0.031015103682875633, -0.08400914072990417, -0.010492232628166676, -0.036716729402542114, 0.011992587707936764, -0.02135922573506832, -0.10575377196073532, 0.00360663328319788, 0.015804026275873184, 0.014665508642792702, 0.03011547587811947, 0.007580913603305817, -0.03580787777900696, -0.02426774799823761, 0.04891863465309143, -0.06387006491422653, 0.041152361780405045, -0.03490824997425079, 0.001384569564834237, -0.019648391753435135, 0.02632378414273262, -0.005247815977782011, 0.024482514709234238, -0.0682603046298027, 0.014650280587375164, -0.07490735501050949, 0.007454212289303541, 0.013566677458584309, 0.03486083820462227, 0.006869934033602476, -0.015909552574157715, 0.009556359611451626, -0.006615736056119204, -0.03205205872654915, 0.040612079203128815, 0.029044605791568756, 0.008379258215427399, -0.02269962802529335, -0.003665998810902238, 0.010141503065824509, -0.009147735312581062, 0.0627518743276596, 0.02951761521399021, 0.017464783042669296, -0.04135621339082718, -0.10898298770189285, 0.013104535639286041, -0.023110566660761833, 0.004226382821798325, 0.022266289219260216, -0.0006040407461114228, -0.01884135790169239, 0.040645722299814224, 0.003922100644558668, -0.022099779918789864, -0.047207701951265335, -0.06289949268102646, 0.050128765404224396, 0.020683690905570984, -0.0019830530509352684, -0.013286364264786243, -0.02336585707962513, -0.004166312050074339, 0.044237688183784485, 0.05549020692706108, 0.031207360327243805, 0.030022097751498222, -0.0054496414959430695, -0.03429102897644043, -0.0029796280432492495, -0.034374166280031204, -0.0128288259729743, 0.05640212446451187, -0.0028950029518455267, -0.0006897833663970232, -0.013601342216134071, -0.010679077357053757, -0.02097325213253498, -0.0013278340920805931, 0.008968404494225979, 0.06545379012823105, -0.011506274342536926, 0.0010925009846687317, -0.020849309861660004, 0.012062673456966877, -0.052155137062072754, 6.531315739266574e-05, 0.021225400269031525, 0.017183711752295494, -0.06067800521850586, 0.037231724709272385, -0.04324810206890106, 0.02388548105955124, -0.0219861026853323, -0.06712409853935242, 0.06465800106525421, -0.05481339618563652, -0.01023850031197071, -0.028207851573824883, 0.0015749779995530844, -0.050674110651016235, 0.013074646703898907, 0.017029542475938797, 0.012880007736384869, 0.012613309547305107, -0.019306037575006485, 0.02019965648651123, 0.028094299137592316, -0.039234887808561325, -0.021067045629024506, -0.037129491567611694, 0.013188596814870834, -0.047212038189172745, -0.008253740146756172, -0.009587199427187443, -0.0022113872691988945, 0.0191730335354805, 0.0007257199031300843, -0.0616283193230629, -0.003810105612501502, 0.06760333478450775, 0.008961019106209278, 0.02452712692320347, 0.007588340900838375, -0.02201254852116108, -0.007371282204985619, -0.015465701930224895, -0.001015469548292458, 0.009274308569729328, -0.00465518981218338, -0.0596008375287056, -0.021989548578858376, 0.045227523893117905, -0.032461803406476974, -0.038107819855213165, -0.052943889051675797, -0.004647588357329369, 0.025640113279223442, -0.018173210322856903, 0.00035049099824391305, 0.03863126412034035, -0.050701405853033066, 0.050323959439992905, 0.026469899341464043, 0.08013617992401123, -0.034021321684122086, -0.0588218979537487, 0.001710830139927566, -0.0673404261469841, 0.04113754257559776, 0.020344339311122894, -0.00896510761231184, -0.006899771746248007, -0.0374063141644001, -0.04868403077125549, -0.013916170224547386, 0.016279127448797226, 0.038410697132349014, -0.011854824610054493, 0.024435097351670265, 0.009869656525552273, -0.009520918130874634, -0.026783129200339317, 0.011783572845160961, -0.07065480947494507, -0.01845376193523407, 0.02735031768679619, 0.007164307404309511, 0.01699560508131981, 0.07502242922782898, 0.04253268986940384, -0.05969271808862686, 0.015667956322431564, 0.012584367766976357, -0.020805928856134415, -0.04567784443497658, 0.007990032434463501, 0.032740186899900436, -0.0044967904686927795, -0.06956381350755692, -0.010613439604640007, -0.04594683274626732, -0.05907085910439491, -0.02308919094502926, -0.03463181480765343, -0.0027918051928281784, -0.015905747190117836, 0.009687905199825764, 0.03378017246723175, 0.010837909765541553, 0.016862519085407257, -0.013572505675256252, 0.022309066727757454, 0.03044428490102291, 0.011658482253551483, 0.021452395245432854, 0.038573626428842545, 0.03796909749507904, -0.01567072793841362, 0.03756283223628998, 0.051227882504463196, -0.0033551387023180723, 0.042494628578424454, 0.006709746550768614, 0.015420020557940006, -0.03267405182123184, -0.021763181313872337, -0.012528805993497372, -0.030517788603901863, 0.00590492133051157, 0.013119252398610115, 0.011033006012439728, -0.005199330393224955, -0.006823177449405193, 0.0071070194244384766, 0.09850434213876724, 0.02136453427374363, 0.04575536027550697, -0.004130864981561899, 0.004952211864292622, -0.006301517598330975, -0.015446100383996964, 0.012485417537391186, 0.017320558428764343, -0.0027096469420939684, 0.0035560019314289093, 0.017782587558031082, -0.024555722251534462, -0.027663061395287514, 0.011464798822999, 0.04391603544354439, 0.030104340985417366, -0.01941314898431301, 0.09129959344863892, -0.08229165524244308, -0.023429732769727707, 0.02858392894268036, 0.03228788822889328, -0.02159786783158779, -0.022941796109080315, -0.0009915597038343549, -0.008010897785425186, -0.028077179566025734, -0.028530199080705643, -0.030626952648162842, 0.012862630188465118, -0.027988065034151077, 0.027100762352347374, 0.0008189414511434734, -0.11926709860563278, -0.02552659809589386, -0.015098984353244305, 0.013741358183324337, 0.009513750672340393, 0.031119083985686302, 0.0017531360499560833, 0.012504946440458298, 0.00257395813241601, -0.004865455906838179, -0.009541905485093594, 0.09122291952371597, -0.05252096429467201, 0.06027059257030487, -0.04163514822721481, 0.009317437186837196, -0.0053072404116392136, 0.00532691041007638, -0.0207924023270607, 0.0798245519399643, -0.0038600650150328875, 0.012915478087961674, 0.024653354659676552, -0.055835459381341934, 0.06553937494754791, 0.03494492918252945, -0.002789985155686736, 0.06104496121406555, 0.007434958126395941, 0.03410299867391586, 0.0050359442830085754, -0.02983841858804226]\n }\n }'", +# "metadata": { +# "title": "Selected text in Untitled-3", +# "enabled": true, +# "icon": "selection", +# "subType": "snippet", +# "subTypeLabel": "Editor Selection", +# "secondaryText": "Untitled-3", +# "fileName": "Untitled-3" +# } +# } +# ] +# } +# ], +# "model_metadata": null, +# "unavailable_resources": [ +# "Pipelines", +# "Vulnerabilities" +# ] +# } diff --git a/ee/lib/gitlab/duo/chat/step_executor.rb b/ee/lib/gitlab/duo/chat/step_executor.rb index 7cedd5acafb81a1718a0374acc736a85b03681e3..622bba3cb94b91b77e80269e42fd3bd64de57c70 100644 --- a/ee/lib/gitlab/duo/chat/step_executor.rb +++ b/ee/lib/gitlab/duo/chat/step_executor.rb @@ -26,7 +26,9 @@ def initialize(user) def step(params) events = [] + debugger perform_agent_request(params) do |event_json| + debugger event = event_parser.parse(event_json) next unless event @@ -67,6 +69,7 @@ def update_observation(observation) attr_reader :user, :event_parser def perform_agent_request(params) + debugger log_conditional_info(user, message: "Request to v2/chat/agent", event_name: 'performing_request', ai_component: 'duo_chat', @@ -87,6 +90,7 @@ def perform_agent_request(params) allow_local_requests: true, stream_body: true ) do |fragment| + debugger log_conditional_info(user, message: "Received a chunk from v2/chat/agent", event_name: 'chunk_received', ai_component: 'duo_chat', fragment: fragment) diff --git a/ee/lib/gitlab/llm/chain/tools/codebase_search/executor.rb b/ee/lib/gitlab/llm/chain/tools/codebase_search/executor.rb index 874474d96ee5511c098ef7e51279592ffeb11e40..e5fdbecc5cce2f9428177d081cf39dd4f417152e 100644 --- a/ee/lib/gitlab/llm/chain/tools/codebase_search/executor.rb +++ b/ee/lib/gitlab/llm/chain/tools/codebase_search/executor.rb @@ -17,6 +17,7 @@ class Executor < Tool # rubocop: disable Search/NamespacedClass -- this is a Duo PROJECT_GLOBAL_ID_PATTERN = %r{gid://gitlab/Project/(\d+)} def perform + debugger return no_repository_contexts_answer unless has_codebase_context? log_semantic_search_requesting @@ -60,6 +61,40 @@ def project_global_ids end def enhance_codebase_context + # [ + # { + # "id": "gid://gitlab/Project/1000000", + # "category": "repository", + # "content": "", + # "metadata": { + # "enabled": true, + # "disabledReasons": [], + # "subType": "repository", + # "subTypeLabel": "Repository", + # "icon": "project", + # "title": "Test", + # "secondaryText": "gitlab-duo/test", + # "webUrl": "http://127.0.0.1:3000/gitlab-duo/test", + # "name": "Test", + # "pathWithNamespace": "gitlab-duo/test", + # "description": null + # } + # }, + # { + # "id": "editor_selection:Untitled-2_2be9e97c-1663-41dc-b254-87a1ffbcaffc", + # "category": "snippet", + # "content": "WITH filtered_projects AS (\n SELECT\n projects.*\n FROM\n projects\n WHERE\n (\n EXISTS (\n SELECT\n 1\n FROM\n project_authorizations\n WHERE\n project_authorizations.user_id = 1 AND\n project_authorizations.project_id = projects.id\n ) OR\n projects.visibility_level IN ( 0, 10, 20 )\n ) AND\n projects.pending_delete = false AND\n projects.hidden = false\n ORDER BY\n projects.id DESC\n)\nSELECT filtered_projects.*\nFROM filtered_projects \nJOIN p_ai_active_context_code_repositories paccr\n ON filtered_projects.id = paccr.project_id\nJOIN ai_active_context_connections active_context_connection\n ON active_context_connection.id = paccr.connection_id\n AND active_context_connection.active = TRUE\nWHERE\n paccr.state = 10\n AND paccr.project_id IN (SELECT id FROM filtered_projects)", + # "metadata": { + # "title": "Selected text in Untitled-2", + # "enabled": true, + # "icon": "selection", + # "subType": "snippet", + # "subTypeLabel": "Editor Selection", + # "secondaryText": "Untitled-2", + # "fileName": "Untitled-2" + # } + # } + # ] context.additional_context.each do |ctx| case ctx[:category] when 'repository' @@ -101,6 +136,7 @@ def directory_info_context(metadata) end def search_results_context(category, project_global_id, path = nil) + debugger project_id = extract_project_id_from_global_id(project_global_id) return "" unless project_id diff --git a/ee/lib/gitlab/llm/completions/chat.rb b/ee/lib/gitlab/llm/completions/chat.rb index e5b7c39f17c4302ae11a238f4fd930b4ba5f6fb4..1e68f7f7d531edf64233b8913fe3fd6fe29b3a4e 100644 --- a/ee/lib/gitlab/llm/completions/chat.rb +++ b/ee/lib/gitlab/llm/completions/chat.rb @@ -62,13 +62,16 @@ def ai_request end def execute + debugger # This can be removed once all clients use the subscription with the `ai_action: "chat"` parameter. # We then can only use `chat_response_handler`. # https://gitlab.com/gitlab-org/gitlab/-/issues/423080 response_handler = ::Gitlab::Llm::ResponseService .new(context, response_options.except(:client_subscription_id)) + debugger response = agent_or_tool_response(response_handler) + debugger response_modifier = Gitlab::Llm::Chain::ResponseModifier.new(response) context.tools_used.each do |tool| @@ -112,6 +115,8 @@ def find_root_namespace end def response_post_processing + # debugger + # tgao return if Rails.env.development? return unless Gitlab::Saas.feature_available?(:duo_chat_categorize_question) @@ -124,6 +129,7 @@ def response_post_processing end def agent_or_tool_response(response_handler) + debugger if response_options[:client_subscription_id] stream_response_handler = ::Gitlab::Llm::ResponseService.new(context, response_options) end @@ -136,7 +142,8 @@ def agent_or_tool_response(response_handler) # since we are not applying it to slash commands yet perform_codebase_search_tool if has_codebase_additional_context? - Gitlab::Duo::Chat::ReactExecutor.new( + debugger + r = Gitlab::Duo::Chat::ReactExecutor.new( user_input: prompt_message.content, thread: prompt_message.thread, tools: tools, @@ -144,6 +151,9 @@ def agent_or_tool_response(response_handler) response_handler: response_handler, stream_response_handler: stream_response_handler ).execute + + debugger + r end def perform_codebase_search_tool diff --git a/ee/lib/gitlab/llm/completions_factory.rb b/ee/lib/gitlab/llm/completions_factory.rb index 245c94712c3c5869908177abcd9ade58fb79736f..30edd04be4d32e64320e09a718e77032eab74d08 100644 --- a/ee/lib/gitlab/llm/completions_factory.rb +++ b/ee/lib/gitlab/llm/completions_factory.rb @@ -16,6 +16,7 @@ def self.completion!(prompt_message, options = {}) feature[:service_class] end + debugger service_class.new(prompt_message, feature[:prompt_class], options.merge(action: name)) end end diff --git a/ee/lib/gitlab/llm/graphql_subscription_response_service.rb b/ee/lib/gitlab/llm/graphql_subscription_response_service.rb index 31021df23e1cebbfb69a0785efbe05e88d3a8230..e4025ba0f0055c596ca01136d7fd42e386589dbc 100644 --- a/ee/lib/gitlab/llm/graphql_subscription_response_service.rb +++ b/ee/lib/gitlab/llm/graphql_subscription_response_service.rb @@ -29,6 +29,7 @@ def response_message end def execute + debugger return unless user response_message.save! if save_message? diff --git a/ee/lib/gitlab/llm/response_service.rb b/ee/lib/gitlab/llm/response_service.rb index 709dc0443e678889fedcc25a4664a700b4f8a7aa..9ccc606e5c37fda5fb810f4486e63fbe5cd5035e 100644 --- a/ee/lib/gitlab/llm/response_service.rb +++ b/ee/lib/gitlab/llm/response_service.rb @@ -10,6 +10,7 @@ def initialize(context, basic_options) end def execute(response:, options: {}, save_message: true) + debugger ::Gitlab::Llm::GraphqlSubscriptionResponseService .new(user, resource, response, options: basic_options.merge(options), diff --git a/gems/gitlab-active-context/lib/active_context/concerns/collection.rb b/gems/gitlab-active-context/lib/active_context/concerns/collection.rb index 81682eb4ceae474a79d0738901d4ab1127d0ae96..39918109fee6d188cc26cab26d498902f87cf951 100644 --- a/gems/gitlab-active-context/lib/active_context/concerns/collection.rb +++ b/gems/gitlab-active-context/lib/active_context/concerns/collection.rb @@ -13,6 +13,7 @@ def track!(*objects) end def search(user:, query:) + debugger ActiveContext.adapter.search(query: query, user: user, collection: self) end diff --git a/gems/gitlab-active-context/lib/active_context/databases/elasticsearch/client.rb b/gems/gitlab-active-context/lib/active_context/databases/elasticsearch/client.rb index 1049f18f4a04aaac3a7b23ca74de1b3ef5438f30..4c092c4f1b6eecb199f28aeb1f05ab1dd4c95265 100644 --- a/gems/gitlab-active-context/lib/active_context/databases/elasticsearch/client.rb +++ b/gems/gitlab-active-context/lib/active_context/databases/elasticsearch/client.rb @@ -16,9 +16,25 @@ def initialize(options) end def search(user:, collection:, query:) + debugger es_query = Processor.transform(collection: collection, node: query, user: user) result = client.search(index: collection.collection_name, body: es_query) + # [ + # { + # "id""=>""3715f782b571c9d90f98bcc1f782d82e5a3cc9909c79d93c16b02585f9c470c2", + # "project_id"=>2, + # "path""=>""encoding/hotfix-1.txt", + # "type"=>1, + # "content""=>""Hotfix 1\n", + # "name""=>""hotfix-1.txt", + # "source""=>""0fb47f093f769008049a0b0976ac3fa6d6125033:0:9", + # "language""=>""", + # "embeddings_v1""=>"[ + # -0.01508432999253273, + # ] + # } + # ] QueryResult.new(result: result, collection: collection, user: user).authorized_results end