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
- 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/
- First, ensure the original completion works by ensuring the
prompt_migration_resolve_vulnerabilityfeature flag is disabled.- Tail the AI Gateway logs with
gdk tail gitlab-ai-gateway. - Test Resolve Vulnerability for any supported CWE listed in a project's vulnerability report.
- In the AI Gateway logs, the path of the request in the logs should be
path=/v1/proxy/anthropic/v1/messagesif theprompt_migration_resolve_vulnerabilityfeature flag is disabled.
- Tail the AI Gateway logs with
- Next, enable the
prompt_migration_resolve_vulnerabilityfeature flag in the GDK. - Clear the cache to ensure a new request to the AIGW
Rails.cache.clear - Test Resolve Vulnerability for the same CWE you tested previously while tailing the AI Gateway logs.
- The path of the request in the logs should be
path=/v1/prompts/resolve_vulnerabilityif theprompt_migration_resolve_vulnerabilityfeature flag is enabled.
- The path of the request in the logs should be
- Ensure the Claude 3.7 prompt is selecting as the model for the Request to LLM. You need to set the
expanded_ai_loggingfeature flag to true to see the logs in thegitlab-ai-gateway
Related to #523496