Add prompt versioning for completions of resolve vulnerability

What does this MR do and why?

This merge request implements prompt versioning for the vulnerability resolution feature by adding support for a new prompt version (0.0.1-dev) when the resolve_vulnerability_claude_3_7_rollout feature flag is enabled. Now the resolve_vulnerability tool should use claude_3_7_sonnet

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

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.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Setup - If needed, follow the instructions in this MR to set up Resolve Vulnerability with AI in the GDK - https://handbook.gitlab.com/handbook/engineering/development/sec/govern/threat-insights/ve_vr_setup/
  2. First, ensure the original completion works by ensuring the prompt_migration_resolve_vulnerability feature flag is disabled.
    1. Tail the AI Gateway logs with gdk tail gitlab-ai-gateway.
    2. Test Resolve Vulnerability for any supported CWE listed in a project's vulnerability report.
    3. In the AI Gateway logs, the path of the request in the logs should be path=/v1/proxy/anthropic/v1/messages if the prompt_migration_resolve_vulnerability feature flag is disabled.
  3. Next, enable the prompt_migration_resolve_vulnerability feature flag in the GDK.
  4. Clear the cache to ensure a new request to the AIGW Rails.cache.clear
  5. Test Resolve Vulnerability for the same CWE you tested previously while tailing the AI Gateway logs.
    1. The path of the request in the logs should be path=/v1/prompts/resolve_vulnerability if the prompt_migration_resolve_vulnerability feature flag is enabled.
  6. Ensure the Claude 3.7 prompt is selecting as the model for the Request to LLM. You need to set the expanded_ai_logging feature flag to true to see the logs in the gitlab-ai-gateway

Related to #523496

Edited by Nathan Weinshenker

Merge request reports

Loading