Skip to content

Commit fe70f79

Browse files
committed
fix(ai): detect Devin's default co-author line
Devin credits itself as `Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>`, which the Devin pattern did not match: it wanted the address right after "Devin". The same pattern accepted any address after a bare "Devin", so a person who signs as `Devin <[email protected]>` was reported as the tool. Match "Devin AI" with any address, a bare "Devin" only with no address or the app's, and the app's address under any name, as for Copilot and Cursor.
1 parent cca58c7 commit fe70f79

4 files changed

Lines changed: 62 additions & 1 deletion

File tree

‎commit_check/ai_signatures_data.py‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,26 @@ def _names(pattern: str) -> re.Pattern[str]:
246246
)
247247

248248
# --- Devin ---
249+
# Devin credits itself as ``Devin AI`` with its GitHub App's address,
250+
# ``158243242+devin-ai-integration[bot]@users.noreply.github.com``.
251+
# "Devin" alone is a person's name, so with an address it counts only when
252+
# the address is the app's.
249253
DEVIN = KnownAiTool(
250254
name="Devin",
251255
name_pattern=_names(r"devin"),
252256
patterns=[
253-
*_identity(r"Devin[ \t]*(?:<[^>\n]*>)?", "Devin"),
257+
*_identity(r"Devin AI[ \t]*(?:<[^>\n]*>)?", "Devin AI"),
258+
*_identity(
259+
r"Devin(?:[ \t]*<(?:\d+\+)?devin-ai-integration\[bot\]"
260+
r"@users\.noreply\.github\.com>)?",
261+
"Devin",
262+
),
263+
# The app's address catches it under any display name.
264+
*_identity(
265+
r"[^<\n]*<(?:\d+\+)?devin-ai-integration\[bot\]"
266+
r"@users\.noreply\.github\.com>",
267+
"... <N+devin-ai-integration[bot]@users.noreply.github.com>",
268+
),
254269
],
255270
)
256271

‎tests/ai_policy_test.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ def test_a_copilot_agent_commit_gets_the_disclosure_appended(self):
170170
)
171171
assert fix_for(message) == f"{message}\nAssisted-by: GitHub Copilot"
172172

173+
def test_a_devin_co_author_becomes_the_disclosure(self):
174+
message = (
175+
"fix: x\n\nCo-Authored-By: Devin AI "
176+
"<158243242+devin-ai-integration[bot]@users.noreply.github.com>"
177+
)
178+
assert fix_for(message) == "fix: x\n\nAssisted-by: Devin AI"
179+
173180
def test_two_tools_give_two_disclosures(self):
174181
message = f"fix: x\n\n{CLAUDE_CO_AUTHOR}\n{COPILOT_CO_AUTHOR}"
175182
assert fix_for(message) == (

‎tests/ai_signatures_test.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ class TestHumanNameFalsePositives:
285285
# contains Copilot.
286286
"Co-authored-by: Jane Dev <[email protected]>",
287287
"Co-authored-by: Copilot Fan <[email protected]>",
288+
# A person who signs with the first name alone.
289+
"Co-authored-by: Devin <[email protected]>",
290+
"Signed-off-by: Devin <[email protected]>",
288291
],
289292
)
290293
def test_bare_human_name_not_detected(self, trailer):
@@ -466,6 +469,24 @@ class TestRoles:
466469
"Cursor",
467470
ROLE_CO_AUTHOR,
468471
),
472+
# What Devin writes, and its app's address under another name.
473+
(
474+
(
475+
"Co-Authored-By: Devin AI "
476+
"<158243242+devin-ai-integration[bot]@users.noreply.github.com>"
477+
),
478+
"Devin",
479+
ROLE_CO_AUTHOR,
480+
),
481+
(
482+
(
483+
"Co-authored-by: devin-ai-integration[bot] "
484+
"<158243242+devin-ai-integration[bot]@users.noreply.github.com>"
485+
),
486+
"Devin",
487+
ROLE_CO_AUTHOR,
488+
),
489+
("Signed-off-by: Devin AI <[email protected]>", "Devin", ROLE_SIGNOFF),
469490
# What Copilot's coding agent leaves: its session-log link on
470491
# each commit, and its bot account when the PR is squash-merged.
471492
(
@@ -580,6 +601,11 @@ class TestPatternIndex:
580601
"Co-authored-by: copilot-swe-agent[bot] "
581602
582603
),
604+
(
605+
"feat: x\n\nCo-Authored-By: Devin AI "
606+
"<158243242+devin-ai-integration[bot]@users.noreply.github.com>"
607+
),
608+
"feat: x\n\nCo-authored-by: Devin <[email protected]>",
583609
],
584610
)
585611
def test_the_grouped_scan_finds_what_every_pattern_would(self, message):

‎tests/engine_test.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,6 +3165,19 @@ def test_forbid_policy_rejects_copilot_coding_agent_commits(self, message):
31653165
context = ValidationContext(stdin_text=message)
31663166
assert validator.validate(context) == ValidationResult.FAIL
31673167

3168+
def test_forbid_policy_rejects_devin_default_co_author(self):
3169+
"""Devin credits itself as "Devin AI" with its app's address."""
3170+
rule = ValidationRule(check="ai_attribution", value="forbid")
3171+
validator = AiAttributionValidator(rule)
3172+
validator._suppress_output = True
3173+
context = ValidationContext(
3174+
stdin_text=(
3175+
"feat: add flag\n\nCo-Authored-By: Devin AI "
3176+
"<158243242+devin-ai-integration[bot]@users.noreply.github.com>"
3177+
)
3178+
)
3179+
assert validator.validate(context) == ValidationResult.FAIL
3180+
31683181
@pytest.mark.benchmark
31693182
def test_forbid_policy_allows_clean_commit(self):
31703183
"""forbid policy allows commits without AI signatures."""

0 commit comments

Comments
 (0)