[PATCH] checkpatch: reject trailers that credit an AI agent

Paolo Bonzini posted 1 patch 3 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260903100441.781277-1-pbonzini@redhat.com
Maintainers: Chao Liu <chao.liu@processmission.com>
scripts/checkpatch.pl | 12 ++++++++++++
1 file changed, 12 insertions(+)
[PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Paolo Bonzini 3 weeks, 2 days ago
The QEMU community has broad consent to not accept assisted-by and similar
trailers, and much less fake co-authored-bys, independent of any AI policy.
Implement this in checkpatch.pl already, so that there is another way for
contributors to discover the AI policy.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/checkpatch.pl | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 03f35e75012..90cb40dfe1f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1811,6 +1811,18 @@ sub process {
 			}
 		}
 
+# Reject trailers that credit an AI agent.
+		if ($realfile =~ /^$/ &&
+		    ($line =~ /🤖/ ||
+		     $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
+		     ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
+		      $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
+			     \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
+			     \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {
+			ERROR("QEMU does not allow using AI for contributions, " .
+				"see docs/devel/code-provenance.rst\n" . $herecurr);
+		}
+
 # Check SPDX-License-Identifier references a permitted license
 		if (($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) &&
 			$rawline !~ /^-/) {
-- 
2.55.0


Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Philippe Mathieu-Daudé 3 weeks, 2 days ago
On 3/9/26 12:04, Paolo Bonzini wrote:
> The QEMU community has broad consent to not accept assisted-by and similar
> trailers, and much less fake co-authored-bys, independent of any AI policy.
> Implement this in checkpatch.pl already, so that there is another way for
> contributors to discover the AI policy.
> 
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   scripts/checkpatch.pl | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 03f35e75012..90cb40dfe1f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1811,6 +1811,18 @@ sub process {
>   			}
>   		}
>   
> +# Reject trailers that credit an AI agent.
> +		if ($realfile =~ /^$/ &&
> +		    ($line =~ /🤖/ ||

Few years ago Peter was concerned about using non-ASCII because
it was not displaying correctly on his terminal:
https://lore.kernel.org/qemu-devel/CAFEAcA-CJwcE9k+TqQ-vDrevzZPV_+CXAr1j9QfR_ivJTJ3e2w@mail.gmail.com/
(that was using Ubuntu 22.04 which we don't support anymore).
Should we still worry about non-ASCII in the repository? Having
a quick look at the OS versions we support it seems all of them
are ready to handle UTF-8 chars. Anyway I saw various utf-8
emoji symbols in gitlab issues, and it is likely someone will
paste one along with the report when filling commit description
for a fix, so they'll end up displayed in a terminal via git-log.

> +		     $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
> +		     ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
> +		      $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
> +			     \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
> +			     \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {
> +			ERROR("QEMU does not allow using AI for contributions, " .
> +				"see docs/devel/code-provenance.rst\n" . $herecurr);
> +		}
> +
>   # Check SPDX-License-Identifier references a permitted license
>   		if (($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) &&
>   			$rawline !~ /^-/) {


Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Peter Maydell 3 weeks, 2 days ago
On Thu, 3 Sept 2026 at 13:15, Philippe Mathieu-Daudé
<philmd@oss.qualcomm.com> wrote:
>
> On 3/9/26 12:04, Paolo Bonzini wrote:
> > The QEMU community has broad consent to not accept assisted-by and similar
> > trailers, and much less fake co-authored-bys, independent of any AI policy.
> > Implement this in checkpatch.pl already, so that there is another way for
> > contributors to discover the AI policy.

> > +# Reject trailers that credit an AI agent.
> > +             if ($realfile =~ /^$/ &&
> > +                 ($line =~ /🤖/ ||
>
> Few years ago Peter was concerned about using non-ASCII because
> it was not displaying correctly on his terminal:
> https://lore.kernel.org/qemu-devel/CAFEAcA-CJwcE9k+TqQ-vDrevzZPV_+CXAr1j9QfR_ivJTJ3e2w@mail.gmail.com/
> (that was using Ubuntu 22.04 which we don't support anymore).
> Should we still worry about non-ASCII in the repository? Having
> a quick look at the OS versions we support it seems all of them
> are ready to handle UTF-8 chars. Anyway I saw various utf-8
> emoji symbols in gitlab issues, and it is likely someone will
> paste one along with the report when filling commit description
> for a fix, so they'll end up displayed in a terminal via git-log.

An emoji in checkpatch because we're specifically looking for it
is probably be fine. Though I guess it's implicitly assuming the
user's locale is UTF-8, which I'm not sure it will be. We seem tu
use \xNN escape sequences elsewhere in this script where we
need to look for oddball non-ASCII, and that would be safer I guess.

In the thread above I was mostly pushing back because that
was a suggestion of using an emoji in *an executable filename*,
which is going to be exposed to many more people than a string
in a script to be run by developers.

thanks
-- PMM
Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Marc-André Lureau 3 weeks, 2 days ago
Hi

On Thu, Sep 3, 2026 at 4:17 PM Philippe Mathieu-Daudé
<philmd@oss.qualcomm.com> wrote:
>
> On 3/9/26 12:04, Paolo Bonzini wrote:
> > The QEMU community has broad consent to not accept assisted-by and similar
> > trailers, and much less fake co-authored-bys, independent of any AI policy.
> > Implement this in checkpatch.pl already, so that there is another way for
> > contributors to discover the AI policy.
> >
> > Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > ---
> >   scripts/checkpatch.pl | 12 ++++++++++++
> >   1 file changed, 12 insertions(+)
> >
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 03f35e75012..90cb40dfe1f 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -1811,6 +1811,18 @@ sub process {
> >                       }
> >               }
> >
> > +# Reject trailers that credit an AI agent.
> > +             if ($realfile =~ /^$/ &&
> > +                 ($line =~ /🤖/ ||
>
> Few years ago Peter was concerned about using non-ASCII because
> it was not displaying correctly on his terminal:
> https://lore.kernel.org/qemu-devel/CAFEAcA-CJwcE9k+TqQ-vDrevzZPV_+CXAr1j9QfR_ivJTJ3e2w@mail.gmail.com/
> (that was using Ubuntu 22.04 which we don't support anymore).
> Should we still worry about non-ASCII in the repository? Having
> a quick look at the OS versions we support it seems all of them
> are ready to handle UTF-8 chars. Anyway I saw various utf-8
> emoji symbols in gitlab issues, and it is likely someone will
> paste one along with the report when filling commit description
> for a fix, so they'll end up displayed in a terminal via git-log.
>


Some projects actually enforce the usage of emoji in commit
messages/titles (Zeeshan's projects, at least). I personally don't
care. It can help, sure, just like icons do. I would much rather have
tags to help classify commits and allow people to display them however
they like, with some tools, though. For that, conventional commits
help somewhat. Just my 2c


-- 
Marc-André Lureau
Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Marc-André Lureau 3 weeks, 2 days ago
Hi

On Thu, Sep 3, 2026 at 2:05 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The QEMU community has broad consent to not accept assisted-by and similar
> trailers, and much less fake co-authored-bys, independent of any AI policy.
> Implement this in checkpatch.pl already, so that there is another way for
> contributors to discover the AI policy.
>
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/checkpatch.pl | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 03f35e75012..90cb40dfe1f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1811,6 +1811,18 @@ sub process {
>                         }
>                 }
>
> +# Reject trailers that credit an AI agent.
> +               if ($realfile =~ /^$/ &&
> +                   ($line =~ /🤖/ ||
> +                    $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
> +                    ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
> +                     $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
> +                            \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
> +                            \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {
> +                       ERROR("QEMU does not allow using AI for contributions, " .
> +                               "see docs/devel/code-provenance.rst\n" . $herecurr);
> +               }
> +
>  # Check SPDX-License-Identifier references a permitted license
>                 if (($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) &&
>                         $rawline !~ /^-/) {
> --

lgtm,
on subject of trailer checks, I would also kindly ask for review:
https://patchew.org/QEMU/20260727161157.2112984-1-marcandre.lureau@redhat.com/

thanks!


-- 
Marc-André Lureau
Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Daniel P. Berrangé 3 weeks, 2 days ago
On Thu, Sep 03, 2026 at 12:04:40PM +0200, Paolo Bonzini wrote:
> The QEMU community has broad consent to not accept assisted-by and similar
> trailers, and much less fake co-authored-bys, independent of any AI policy.
> Implement this in checkpatch.pl already, so that there is another way for
> contributors to discover the AI policy.
> 
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  scripts/checkpatch.pl | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 03f35e75012..90cb40dfe1f 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -1811,6 +1811,18 @@ sub process {
>  			}
>  		}
>  
> +# Reject trailers that credit an AI agent.
> +		if ($realfile =~ /^$/ &&
> +		    ($line =~ /🤖/ ||

Oh wow, is that something people actually do :-)

> +		     $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
> +		     ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
> +		      $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
> +			     \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
> +			     \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {

I presume the qualifiers after gemini/claude are a mitigation against
accidentally matching a real person's name ?

> +			ERROR("QEMU does not allow using AI for contributions, " .
> +				"see docs/devel/code-provenance.rst\n" . $herecurr);
> +		}

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Paolo Bonzini 3 weeks, 2 days ago
On 9/3/26 12:14, Daniel P. Berrangé wrote:
>> +# Reject trailers that credit an AI agent.
>> +		if ($realfile =~ /^$/ &&
>> +		    ($line =~ /🤖/ ||
> 
> Oh wow, is that something people actually do :-)

IIRC it's more in pull requests but it was fun to add.

>> +		     $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
>> +		     ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
>> +		      $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
>> +			     \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
>> +			     \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {
> 
> I presume the qualifiers after gemini/claude are a mitigation against
> accidentally matching a real person's name ?

For Claude yes, for Gemini I guess it's not really needed.  BTW I have 
no idea which coding harnesses use Co-authored-by specifically so this 
is really just a guess.

Paolo

>> +			ERROR("QEMU does not allow using AI for contributions, " .
>> +				"see docs/devel/code-provenance.rst\n" . $herecurr);
>> +		}
> 
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> 
> 
> With regards,
> Daniel


Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Daniel P. Berrangé 3 weeks, 2 days ago
On Thu, Sep 03, 2026 at 12:19:11PM +0200, Paolo Bonzini wrote:
> On 9/3/26 12:14, Daniel P. Berrangé wrote:
> > > +# Reject trailers that credit an AI agent.
> > > +		if ($realfile =~ /^$/ &&
> > > +		    ($line =~ /🤖/ ||
> > 
> > Oh wow, is that something people actually do :-)
> 
> IIRC it's more in pull requests but it was fun to add.
> 
> > > +		     $line =~ /^\s*(?:Assisted|Generated)-by:/i ||
> > > +		     ($line =~ /^\s*Co-authored-by:\s*(.*?)\s*$/i &&
> > > +		      $1 =~ /\bcopilot\b | \bchatgpt\b | \bcodex\b | \bcursor\b | \[bot\] |
> > > +			     \bllama\b | \bgemini\b.*(?:pro|flash|ultra|google\.com) |
> > > +			     \bclaude\b.*(?:opus|sonnet|fable|haiku|anthropic\.com)/xi))) {
> > 
> > I presume the qualifiers after gemini/claude are a mitigation against
> > accidentally matching a real person's name ?
> 
> For Claude yes, for Gemini I guess it's not really needed.  BTW I have no
> idea which coding harnesses use Co-authored-by specifically so this is
> really just a guess.

I expect Co-authored-by is often added by the contributor themselves


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Re: [PATCH] checkpatch: reject trailers that credit an AI agent
Posted by Paolo Bonzini 3 weeks, 2 days ago
On Thu, Sep 3, 2026 at 12:26 PM Daniel P. Berrangé <berrange@redhat.com> wrote:
> > For Claude yes, for Gemini I guess it's not really needed.  BTW I have no
> > idea which coding harnesses use Co-authored-by specifically so this is
> > really just a guess.
>
> I expect Co-authored-by is often added by the contributor themselves

$ strings ~/bin/codex |grep -i Co-authored-by
- Commit messages must end with `Co-authored-by: Codex <noreply@openai.com>`.

Straight from the system prompt. *puke*

Claude Code also has "Co-Authored-By: ${d3o(at())} <noreply@anthropic.com>"

Adding "noreply" to the list is probably a good idea too.

Paolo