Amazon Q dev commit blocked by push rules due to commit message
Summary
GitLab Duo Chat's /q dev
command creates commits with automatically generated commit messages without providing an interface to edit the commit message before creation. This prevents the feature from being used in projects with push rules that require specific commit message patterns (such as JIRA ticket references) or CI/CD pipelines that validate commit message formats.
Steps to reproduce
- Set up a project with push rules that require a specific commit message pattern (e.g., requiring JIRA ticket references)
- Create a merge request with some code changes
- Add a review comment suggesting improvements to the code
- Reply to the review comment with
/q dev
to generate automated fixes - Observe that GitLab Duo Chat attempts to create a commit but fails due to push rule validation
Example Project
Any project with push rules configured for commit message validation, such as:
-
JIRA\-\d+
pattern requiring JIRA ticket references - Conventional commit patterns like
^(feat|fix|docs|style|refactor|test|chore):
What is the current bug behavior?
The /q dev
command generates commits with generic, automatically created commit messages that may not conform to project-specific commit message requirements enforced by push rules. This results in:
- Push failures when push rules reject the auto-generated commit message
- Pipeline failures when CI/CD jobs validate commit message formats
- Inability to merge when "Pipelines must succeed" is enabled
The user has no opportunity to customize or edit the commit message before the commit is created.
What is the expected correct behavior?
The /q dev
command should either:
-
Preferred: Provide an interface to edit/customize the commit message before creating the commit, similar to how
/q review
allows commit message customization when applying suggestions - Alternative: Respect project-level commit message templates or patterns when generating automatic commit messages
- Fallback: Generate commit messages that follow common enterprise patterns (e.g., include placeholder text for JIRA tickets that can be easily identified and replaced)
Relevant logs and/or screenshots
When push rules are configured, the error typically appears as:
remote: GitLab: Commit message does not follow the pattern '<pattern>'
Possible fixes
-
Add commit message editing interface: Modify the
/q dev
workflow to present a commit message editing dialog before creating the commit, similar to the merge request suggestion workflow -
Integrate with project settings: Make
/q dev
respect project-level commit message templates or push rule patterns when generating commit messages - Add configuration option: Allow projects to configure default commit message templates for GitLab Duo Chat operations
The implementation would likely need changes in:
- The GitLab Duo Chat frontend interface to add commit message editing
- The backend service that processes
/q dev
commands to support commit message customization - Integration with existing push rule validation to provide better error handling