Add review_merge_request_dap feature setting to decouple DAP code review model config

What does this MR do and why?

Introduces a dedicated review_merge_request_dap feature setting (ID 21) for the DAP code review flow so that Classic DCR (review_merge_request) and DAP code review have independent model selection entries in the admin UI.

Problem

Both flows currently resolve the same FeatureSetting record because WorkflowContextGenerationService#ai_feature returns :review_merge_request for code_review/v1. When the review_merge_request default was upgraded to Sonnet 4.6, Classic DCR timed out on large MRs (single blocking LLM call) while DAP handled it fine (agentic pipeline with compaction) — forcing both flows to be reverted together.

Solution

Following the same pattern used for the duo_agent_platformduo_agent_platform_agentic_chat split (!213517 (merged)).

UI entry Feature setting ID Flow
Code Review review_merge_request 15 Classic DCR
Code Review (Agentic) review_merge_request_dap 21 DAP code review
Agents & flows duo_agent_platform 16 All other DAP flows

How to set up and validate locally

  1. Run the migrations:

    bin/rails db:migrate
  2. Verify the three tables have a row for review_merge_request_dap (feature = 21) copied from review_merge_request (feature = 15):

    # Rails console
    Ai::FeatureSetting.find_by(feature: :review_merge_request_dap)
    Ai::ModelSelection::NamespaceFeatureSetting.where(feature: :review_merge_request_dap).count
    Ai::InstanceFeatureSetting.where(feature: :review_merge_request_dap).count
  3. Navigate to Admin area → AI-powered features and confirm a "Code Review (Agentic)" entry appears alongside "Code Review" with independent model selection.

  4. Enable the feature flag and verify WorkflowContextGenerationService#ai_feature returns the new symbol for a DAP code review workflow:

    # Rails console
    Feature.enable(:review_merge_request_dap_model_config)
    
    user = User.find_by(username: 'your-username')
    service = Ai::DuoWorkflows::WorkflowContextGenerationService.new(
      current_user: user,
      workflow_definition: Ai::Catalog::FoundationalFlow['code_review/v1'].foundational_flow_reference
    )
    service.send(:ai_feature) # => :review_merge_request_dap
  5. Disable the flag and confirm the method falls back to :review_merge_request:

    Feature.disable(:review_merge_request_dap_model_config)
    service.send(:ai_feature) # => :review_merge_request

Local Testing

Classic DCR Code Review DAP flow LS trace with FF disabled (used Sonnet 4) LS trace with FF enabled (used Sonnet 4.6)
Screenshot_2026-05-19_at_4.29.21_PM Screenshot_2026-05-19_at_4.28.38_PM Trace Trace

References

Edited by Kinshuk Singh

Merge request reports

Loading