]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Detect Co-Authored-By trailers and reject AI co-authors
authorMichal Nowak <mnowak@isc.org>
Tue, 5 May 2026 17:05:49 +0000 (19:05 +0200)
committerMichal Nowak <mnowak@isc.org>
Fri, 12 Jun 2026 09:05:14 +0000 (11:05 +0200)
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
dangerfile.py

index c1ce4ea09411a864b3583ca5bef353b303896214..9cc849b2403c962ab324706f3a6903b3b2816f55 100644 (file)
@@ -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(