Skip to content

Add generate_commit_message_claude_3_7 feature flag

What does this MR do and why?

This MR adds generate_commit_message_claude_3_7 feature flag to support the new prompt with Claude 3.7.

NOTE: We need to wait until gitlab-org/modelops/applied-ml/code-suggestions/ai-assist!2078 (merged) gets merged first. This won't work if that change is not merged first.

UPDATED: We need to specify old version 1.0.0 due to the fact that ai_gateway serves the latest minor version by default. It would serve 1.1.0 even without the feature flag so we should stop that.

References

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. In rails console enable the experiment fully
    Feature.enable(:generate_commit_message_claude_3_7)
  2. Create a new MR with some commits.
  3. Run tail -f log/llm.log | jq in console to check llm logs later
  4. Click Edit commit message within merge request widget section.
  5. Press Generate commit message and verify the generated commit message looks ok
  6. Verify the correct prompt_version is used via the llm logs. Look for something like this under generate_commit_message action:
"body": {
    "inputs": {
      "diff": "@@ -18,6 +18,20 @@ module Gitlab\n       default_regex\n     end\n \n+    def path_regex\n+      default_regex\n+    end\n+\n+    def add(x, y)\n+      x - y\n+    end\n+\n+    def multiply(x, y)\n+      x / y\n+    end\n+\n+    def\n+\n     def archive_formats_regex\n       /(zip|tar|7z|tar\\.gz|tgz|gz|tar\\.bz2|tbz|tbz2|tb2|bz2)/\n     end\n"
    },
    "prompt_version": "1.1.0"
  },

Related to #521392

Edited by Sincheol (David) Kim

Merge request reports

Loading