From: Michal Nowak Date: Tue, 5 May 2026 17:05:49 +0000 (+0200) Subject: Detect Co-Authored-By trailers and reject AI co-authors X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5e9dd3dd6644dd52a28f8bb2a9a9a3a67474989;p=thirdparty%2Fbind9.git Detect Co-Authored-By trailers and reject AI co-authors CONTRIBUTING.md states that AI agents must not be listed as co-authors and that contributors should use the `Assisted-by:` trailer instead. Teach `dangerfile.py` to fail merge requests whose commit messages include a `Co-Authored-By:` trailer naming a known LLM (Claude, Codex, Mistral, Copilot, Gemini, Cursor, Devin, Aider, Sourcegraph, CodeWhisperer). For any other `Co-Authored-By:` trailer, emit an info-level `message()` that includes the full trailer line so reviewers can confirm the named co-author is a human contributor and not an unrecognised AI tool. Assisted-by: Claude:claude-opus-4-7 --- diff --git a/dangerfile.py b/dangerfile.py index c1ce4ea0941..9cc849b2403 100644 --- a/dangerfile.py +++ b/dangerfile.py @@ -156,6 +156,24 @@ if match: PROHIBITED_WORDS_RE = re.compile( "^(WIP|wip|DROP|drop|DROPME|checkpoint|experiment|TODO|todo)[^a-zA-Z]" ) +# `Co-Authored-By` trailers naming an AI agent are forbidden by +# CONTRIBUTING.md; contributors must use the `Assisted-by` trailer instead. +LLM_COAUTHORED_BY_RE = re.compile( + r"^Co-Authored-By:.*\b(" + r"claude|anthropic|" + r"codex|openai|chatgpt|gpt-[0-9]|" + r"mistral|" + r"copilot|" + r"gemini|bard|" + r"cursor|" + r"devin|cognition|" + r"aider|" + r"sourcegraph|" + r"codewhisperer" + r")\b", + re.IGNORECASE | re.MULTILINE, +) +COAUTHORED_BY_RE = re.compile(r"^Co-Authored-By:.*$", re.IGNORECASE | re.MULTILINE) fixup_error_logged = False for commit in danger.git.commits: message_lines = commit.message.splitlines() @@ -178,6 +196,23 @@ for commit in danger.git.commits: f"Prohibited keyword `{match.groups()[0]}` detected " f"at the start of a subject line in commit {commit.sha}." ) + match = LLM_COAUTHORED_BY_RE.search(commit.message) + if match: + fail( + f"Commit {commit.sha} contains a `Co-Authored-By` trailer " + f"naming an AI tool (`{match.group(1)}`). Per `CONTRIBUTING.md`, " + "AI agents are not co-authors and must not be listed with " + "`Co-Authored-By`. Use the `Assisted-by:` trailer instead " + "(e.g. `Assisted-by: Claude:claude-opus-4-7`)." + ) + else: + for coauthor_line in COAUTHORED_BY_RE.findall(commit.message): + message( + f"Commit {commit.sha} contains a `Co-Authored-By` trailer: " + f"```{coauthor_line}```. Ensure the named co-author is a " + "human contributor. AI tools must use the `Assisted-by:` " + "trailer instead." + ) match = MR_TITLE_RE.match(subject) if match and match.group(5) is not None and not is_merge: fail(