Repository navigation
feat(ai): reject commits whose author is an AI tool (CC017) - #661
Conversation
The AI rules read only the message, so a commit authored by the agent
itself, with the person at most a Co-authored-by line, passed both forbid
and disclose: Jules (google-labs-jules[bot]), OpenHands
(openhands <openhands@all-hands.dev>), Aider ("<name> (aider)"),
claude[bot], Copilot and devin-ai-integration[bot] all did.
CC017 ai-author reads the author of the commit under test and judges it
as the same identity on a Co-authored-by line, so the two can't disagree
about who is a tool. It is built under both forbid and disclose: a tool
in the author's place takes a person's place even more than a co-author
line does. A project that accepts agent-authored commits can list CC017
under warn. It reads an existing commit (--rev, or HEAD); a message not
yet committed has no author and passes.
The GitHub App identities of Claude, Cursor's background agent, Codex
cloud and Amazon Q Developer are added, so they count as co-authors too.
A commit-msg hook or a piped message has no commit to read, so CC017 now reads the author git would record: git var GIT_AUTHOR_IDENT honours GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL the way git commit does, which is how Aider commits as "<name> (aider)", and falls back to user.name and user.email. With no identity at all, nothing is flagged.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 15 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #661 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 2462 2499 +37
Branches 478 484 +6
=========================================
+ Hits 2462 2499 +37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Merging this PR will not alter performance1 warning
Comparing Footnotes
|



What
The AI rules read only the commit message. So a commit authored by the agent itself, with the person at most a
Co-authored-by:line, passed bothforbidanddisclose. Projects that adoptedforbidhave written policies such as "commits must be authored by you" and "AI tools must not be listed as commit authors or co-authors". Those policies were not enforced for this case.New rule CC017
ai-authorreads the author of the commit under test. It judges the author exactly as the same identity on aCo-authored-by:line, so the two checks can never disagree about who is a tool.forbidanddisclose. Underdisclose, CC015 already refuses the tool as a co-author, and the author slot takes a person's place even more.CC017underwarn.ignore_authorsskips it like the other commit rules.--rev, or HEAD): reads the recorded author.api.validate_message, the MCPvalidate_messagetool): reads the author git would record, viagit var GIT_AUTHOR_IDENT. That honoursGIT_AUTHOR_NAME/GIT_AUTHOR_EMAILthe waygit commitdoes, which is how Aider commits as<name> (aider). It fires only when that identity is an AI tool, which is exactly when the commit about to be made would be authored by one. With no identity at all, nothing is flagged.It also adds the GitHub App identities of Claude (
claude[bot]), Cursor's background agent (cursor[bot]), Codex cloud (chatgpt-codex-connector[bot]) and Amazon Q Developer (amazon-q-developer[bot]). The App already checks commits from these accounts; now they also count as co-authors.ignore_authorson a piped message now takesGIT_AUTHOR_NAMEbeforeuser.name, the same order git uses. Without the variable, nothing changes. With it, a piped message is judged by the author it names. commit-check-action#321 uses this to hand over each pull request commit's author.Before / after
Commit message
Fix parser crash+Co-authored-by: Jane Dev <jane@example.com>, checked withcommit-check -m --rev <sha>:google-labs-jules[bot]openhands <openhands@all-hands.dev>Jane Dev (aider)claude[bot]Copilot <198982749+Copilot@users.noreply.github.com>devin-ai-integration[bot]Jane Dev,dependabot[bot],renovate[bot]Under
forbid, the suggestion stops after--reset-author.Piped message,
ignore_authors = ["Renovate Bot"],GIT_AUTHOR_NAME=Renovate Bot: before, the message was checked under the runner'suser.name. After, it is skipped.False positives
I ran the detector over every author in junit-framework's last 3,000 commits (93 identities, including renovate, dependabot, github-actions and pre-commit-ci) and over this org's repos: no matches.
Checks
pytest: 1563 passed, 100% line and branch coverage. The one failure,test_load_config_file_permission_error, also fails on main when run as root. ruff check and ruff format are clean.TestFixOptionnow pinsGIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL, because on a machine whose git identity is an agent, the pending author is an AI tool. The README rule table now says CC013–CC017.The site's rules page needs a CC017 section. It goes in the release docs PR, because commit-check.com documents released behaviour only.