feat/autofix: get explanations from agent fix response, fall back to AI Explain - #150
feat/autofix: get explanations from agent fix response, fall back to AI Explain#150BBerabi wants to merge 2 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
… explanation AI Explain is being deprecated in favor of explanations returned directly by Autofix/Agent Fix. GetAutofixDiffs now falls back to the deprecated AI Explain service only for suggestions missing an explanation, so both consumers on the old backend and the new one are supported during rollout without duplicating this decision in every caller.
PR Reviewer Guide 🔍
|
Description
AI Explain is being deprecated. Newer Agent Fix / Autofix responses already include an explanation per suggestion, so we no longer need a separate call to the (deprecated) AI Explain service in that case.
This PR:
explanationfield from the sast-autofix-api response through toAutofixUnifiedDiffSuggestion.Explanation.AutofixOptions.ExplainEndpoint. When set,GetAutofixDiffsfalls back to the deprecated AI Explain service, but only for suggestions whose response did not already include an explanation. Suggestions that already have one are left untouched, and the AI Explain call is skipped entirely if none are missing or noExplainEndpointis configured.This keeps the decision of "do we still need AI Explain" in one place (code-client-go) rather than duplicated across every consumer (snyk-ls, remy-cli-extension, native-pr-experience), so it supports both flows during rollout without a coordinated multi-repo change.
Checklist
🚨After having merged, please update the
snyk-lsand CLI go.mod to pull in latest client.Consumers that want the fallback need to pass
ExplainEndpointinAutofixOptionsand can drop their own "call AI Explain unconditionally" logic (e.g.AiFixHandler.EnrichWithExplainin snyk-ls).