Skip to content

ci: reject Claude and Codex co-authors in PR commits - #4061

Open
TomCC7 wants to merge 3 commits into
mainfrom
chore/ci-no-ai-coauthors
Open

ci: reject Claude and Codex co-authors in PR commits#4061
TomCC7 wants to merge 3 commits into
mainfrom
chore/ci-no-ai-coauthors

Conversation

@TomCC7

@TomCC7 TomCC7 commented Sep 10, 2026

Copy link
Copy Markdown
Member

Contribution path

Small CI fix; no tracking issue.

Problem

Commit 11f4958 reached main with a Claude co-author trailer. The existing check was case-sensitive and CI did not supply the commit range it needed to inspect.

Solution

Add a No AI co-authors job to the existing ci-complete gate, which main's active ruleset already requires. Check every incoming commit for pull requests and merge groups using full Git history and the event's base/head SHAs.

Reject co-author lines containing Claude, Codex, or an anthropic.com/openai.com email, regardless of capitalization. Report offending commit SHAs and ask contributors to amend them. Ordinary human co-authors and mentions of AI tools in commit prose pass; existing base-branch history is excluded.

Reuse the existing commit-check script and run its regression tests in lint CI. No new dependencies or repository settings changes.

How to Test

uv run pytest -c /dev/null --rootdir . --noconftest bin/hooks/test_filter_commit_message.py

18 tests passed, covering mixed-case trailers, both tools, human co-authors, older commits, merge parents, base-history exclusion, and invalid ranges. Also verified that the exact reported commit fails. Ruff, targeted mypy, workflow YAML validation, and commit hooks passed.

AI assistance

Codex (GPT-6) implemented and locally validated this change.

Checklist

  • I have read and approved the CLA.

Intentional negative test for PR #4061; no code changes.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Intentional clean follow-up commit for PR #4061; no code changes.
@greptile-apps

greptile-apps Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

Not safe to merge until legitimate human co-author trailers containing the name Claude are accepted.

Findings

  1. P1 Human Claudes Are Rejected

Summary

  • This change adds commit-message scanning for AI co-author trailers. A reproduced false positive rejects legitimate human co-authors named Claude, so it should not merge until the detection is narrowed.

Reviews (1) · Last reviewed commit: "ci: reject AI co-authors in incoming com..."


AI_COAUTHOR = re.compile(
r"^[ \t]*Co-authored-by[ \t]*:[^\r\n]*"
r"(?:\bClaude\b|\bCodex\b|<[^<>\r\n]*@(?:anthropic\.com|openai\.com)>)",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Human Claudes Are Rejected

The name-only \bClaude\b alternative treats any co-author with Claude as a first or last name as an AI co-author, regardless of the email address. A normal trailer such as Co-authored-by: Claude Smith <claude@example.com> makes the required commit check fail and blocks otherwise valid changes from merging. This must be corrected before merging.

Artifacts

Evidence from the check

  • Creates a temporary Git repository, commits the stated trailer, independently checks the regex, and invokes the hook over the commit range; it reproduces the false rejection.

Command output from the check

  • Captured output from running the reproduction script in `/home/user/repo`, showing an independent regex match and `--check` exit status 1 with its exact diagnostic; it confirms the false rejection.

View artifacts

T-Rex Ran code and verified through T-Rex

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #4061      +/-   ##
==========================================
- Coverage   78.21%   78.21%   -0.01%     
==========================================
  Files        1428     1428              
  Lines      135077   135077              
  Branches    11708    11708              
==========================================
- Hits       105653   105647       -6     
- Misses      26104    26110       +6     
  Partials     3320     3320              
Components Coverage Δ
Tests 94.72% <ø> (ø)
Flag Coverage Δ
OS-ubuntu-24.04-arm 74.53% <ø> (-0.01%) ⬇️
OS-ubuntu-latest 75.10% <ø> (-0.01%) ⬇️
Py-3.10 75.09% <ø> (ø)
Py-3.11 75.10% <ø> (-0.01%) ⬇️
Py-3.12 ?
Py-3.13 ?
Py-3.14 75.10% <ø> (-0.01%) ⬇️
Py-3.14t 75.09% <ø> (-0.01%) ⬇️
SelfHosted-Linux 35.58% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant