Improve error handling for the generate commit message action

What does this MR do and why?

Improve error handling on the Generate commit message feature so it doesn't leave a hanging modal when the API call to the AI Gateway fails (in the case of the related issue, due to a missing prompt).

This improves UX as it shows a nicer error message rather than leaving the user with no information about the progress of their request.

References

Related to #578687

Screenshots or screen recordings

Kapture_2025-11-05_at_15.41.15

How to set up and validate locally

Temporarily apply the diff below and follow the steps shown in the gif above.

diff --git a/ee/lib/gitlab/llm/ai_gateway/completions/generate_commit_message.rb b/ee/lib/gitlab/llm/ai_gateway/completions/generate_commit_message.rb
index 8789158fdc48..29ef946c0055 100644
--- a/ee/lib/gitlab/llm/ai_gateway/completions/generate_commit_message.rb
+++ b/ee/lib/gitlab/llm/ai_gateway/completions/generate_commit_message.rb
@@ -16,7 +16,7 @@ def inputs
 
           override :prompt_version
           def prompt_version
-            ::Ai::AmazonQ.enabled? ? 'amazon_q/1.0.0' : '1.2.0'
+            ::Ai::AmazonQ.enabled? ? 'amazon_q/1.0.0' : '1.3.0'
           end
 
           override :root_namespace

MR acceptance checklist

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

Edited by Wanderson Policarpo

Merge request reports

Loading