-
Notifications
You must be signed in to change notification settings - Fork 8
Description
I'm using dotnet-aicommitmessage to generate commit messages based on branch name, commit message, and git diff via an AI model. However, in some environments (e.g., corporate or restricted networks), API calls to the AI provider may fail due to network restrictions or policies.
Currently, when an API error occurs, the tool throws an exception internally and simply returns the original message without any transformation, which can interrupt workflows unexpectedly.
🧩 Feature Request
Introduce a new environment variable:
DOTNET_AICOMMITMESSAGE_IGNORE_API_ERRORS=true
When this variable is set:
-
If a network/API error occurs when calling the AI model, the tool should gracefully catch and suppress the exception.
-
Instead of failing, it should continue processing and fallback to returning the original or partially transformed message as needed.
This would be especially helpful in CI/CD pipelines or developer environments where occasional API issues shouldn't block the commit process.
✅ Existing Related Functionality
There is already a -skipai flag that can be appended to the commit message (e.g., -skipai) to skip AI processing entirely. This new env variable would complement that by providing a more transparent fallback mechanism when issues arise, without requiring changes to individual commit messages.
💡 Suggested Behavior
| Scenario | -skipai Present | DOTNET_AICOMMITMESSAGE_IGNORE_API_ERRORS Set | AI API Down | Result |
|---|---|---|---|---|
| ✅ | Yes | No | Yes/No | AI is skipped, no API call |
| ✅ | No | Yes | Yes | Graceful fallback, no crash |
| ❌ | No | No | Yes | Current behavior: throws exception and returns unmodified message |
📌 Notes
-
This should ideally log a warning (not error) when
DOTNET_AICOMMITMESSAGE_IGNORE_API_ERRORSis active and an exception occurs, to aid debugging.