Skip to content

ci: block Co-Authored-By: <AI> trailers, recommend Assisted-By#7

Open
Andrei Kvapil (kvaps) wants to merge 1 commit into
mainfrom
ci/commit-trailer-check
Open

ci: block Co-Authored-By: <AI> trailers, recommend Assisted-By#7
Andrei Kvapil (kvaps) wants to merge 1 commit into
mainfrom
ci/commit-trailer-check

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented Jul 16, 2026

Copy link
Copy Markdown
Member

What

Adds an org-wide reusable workflow commit-trailers that fails a PR when any of its commits carries a Co-Authored-By: <…@anthropic.com> trailer (the trailer Claude Code stamps by default), and points the contributor at an informational Assisted-By: Claude trailer instead.

Intended to be enforced across the org via an Organization Ruleset → "Require workflows to pass before merging" pointing at this file (added separately by an org admin, in Evaluate mode first).

Why

Under US copyright law — which governs CNCF projects — a Co-Authored-By trailer naming an AI agent can attribute rights over the code to its vendor. Assisted-By: discloses AI assistance without transferring authorship, and is the emerging convention (Linux kernel, Fedora, LLVM). See anthropics/claude-code#66602.

Notes

  • The check keys on the @anthropic.com address, so it does not block legitimate human co-authors.
  • It only gates new PRs; history is not rewritten.
  • Prevent the trailer at source with the Claude Code setting includeCoAuthoredBy: false.
  • Repos that follow Kubernetes-style rules (no trailers at all, AI disclosed in the PR body) should be excluded from the ruleset target.

Summary by CodeRabbit

  • Chores
    • Added a new automated pull request check that scans commit messages for co-author trailers associated with AI tooling/agents.
    • Pull requests with matching commit metadata will fail the check and include findings in the workflow summary.

@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@kvaps
Andrei Kvapil (kvaps) marked this pull request as ready for review July 16, 2026 15:24
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a read-only GitHub Actions workflow that scans pull request commits for Co-Authored-By trailers matching known AI-agent identifiers and fails the job when matches are found.

Changes

Commit trailer validation

Layer / File(s) Summary
Workflow detection and reporting
.github/workflows/commit-trailers.yml
Triggers on pull request and merge queue events, paginates commits, detects configured AI-agent co-author trailers, and reports offenders through the job summary and failure status.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubEvent
  participant CommitTrailerWorkflow
  participant GitHubAPI
  participant JobSummary
  GitHubEvent->>CommitTrailerWorkflow: trigger pull_request or merge_group
  CommitTrailerWorkflow->>GitHubAPI: paginate pull request commits
  GitHubAPI-->>CommitTrailerWorkflow: commit messages
  CommitTrailerWorkflow->>JobSummary: write matching commit details
  CommitTrailerWorkflow-->>GitHubEvent: succeed or fail workflow
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the new CI workflow that blocks AI-related Co-Authored-By trailers and suggests Assisted-By instead.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/commit-trailer-check

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/commit-trailers.yml:
- Line 49: Update the summary-writing statement in the workflow step to await
the Promise returned by core.summary.write(), ensuring the asynchronous write
completes before the step exits.
- Line 14: Quote the entire step name value in the workflow step named Reject
"Co-Authored-By: <AI>" trailers, using single quotes so the embedded colon-space
sequence is parsed as plain text rather than YAML syntax.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c3be0272-9bd0-4899-be22-55c507844756

📥 Commits

Reviewing files that changed from the base of the PR and between 3dd87f3 and a232ef7.

📒 Files selected for processing (1)
  • .github/workflows/commit-trailers.yml

Comment thread .github/workflows/commit-trailers.yml Outdated
no-ai-coauthor:
runs-on: ubuntu-latest
steps:
- name: Reject "Co-Authored-By: <AI>" trailers

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Fix YAML syntax error.

The string contains a colon followed by a space (: ) inside an unquoted scalar, which YAML parses as a mapping key-value pair. This causes a syntax error. Wrap the entire value in single quotes.

🐛 Proposed fix
-      - name: Reject "Co-Authored-By: <AI>" trailers
+      - name: 'Reject "Co-Authored-By: <AI>" trailers'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Reject "Co-Authored-By: <AI>" trailers
- name: 'Reject "Co-Authored-By: <AI>" trailers'
🧰 Tools
🪛 actionlint (1.7.12)

[error] 14-14: could not parse as YAML: mapping values are not allowed in this context

(syntax-check)

🪛 YAMLlint (1.37.1)

[error] 14-14: syntax error: mapping values are not allowed here

(syntax)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/commit-trailers.yml at line 14, Quote the entire step name
value in the workflow step named Reject "Co-Authored-By: <AI>" trailers, using
single quotes so the embedded colon-space sequence is parsed as plain text
rather than YAML syntax.

Source: Linters/SAST tools

Comment thread .github/workflows/commit-trailers.yml Outdated

@myasnikovdaniil myasnikovdaniil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Andrei Kvapil (@kvaps) Please widen check to other popular agents and address bot reviews. Also commit signoff is missing.

Signed-off-by: Andrei Kvapil <kvapss@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/commit-trailers.yml (1)

51-63: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Improve markdown formatting for the job summary.

In GitHub Actions job summaries, single newlines within the same block are rendered as spaces in Markdown. As currently written, the last two actionable lines will wrap together into a single sentence.

Consider formatting them as a bulleted list (or using double newlines) so they render clearly on separate lines.

♻️ Proposed refactor
             const msg = [
               `Commits ${offenders.join(', ')} carry a "Co-Authored-By: <AI agent>" trailer.`,
               '',
               'Under US copyright law (which governs CNCF projects) a Co-Authored-By',
               'trailer naming an AI agent can attribute rights over the code to its',
               'vendor. Use an informational "Assisted-By: <agent>" trailer instead — it',
               'discloses AI assistance without transferring authorship.',
               '',
               'Rationale: https://github.com/anthropics/claude-code/issues/66602',
               '',
-              'Fix: rebase and amend the trailer, then force-push.',
-              'Prevent it at source: set includeCoAuthoredBy: false in your Claude Code settings.',
+              '- **Fix:** rebase and amend the trailer, then force-push.',
+              '- **Prevent it at source:** set `includeCoAuthoredBy: false` in your Claude Code settings.',
             ].join('\n');
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/commit-trailers.yml around lines 51 - 63, Update the msg
construction in the workflow so the final “Fix” and “Prevent it at source”
actions render as distinct Markdown lines in the GitHub Actions job summary,
preferably by formatting them as separate bullets or blocks while preserving
their existing text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/commit-trailers.yml:
- Around line 51-63: Update the msg construction in the workflow so the final
“Fix” and “Prevent it at source” actions render as distinct Markdown lines in
the GitHub Actions job summary, preferably by formatting them as separate
bullets or blocks while preserving their existing text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a1dcf8ae-f6d5-46c5-9934-c5f91e1a5756

📥 Commits

Reviewing files that changed from the base of the PR and between a232ef7 and c79badf.

📒 Files selected for processing (1)
  • .github/workflows/commit-trailers.yml

@kvaps

Copy link
Copy Markdown
Member Author

Addressed:

  • Widened to popular agents — the check now also matches GitHub Copilot, Devin, Cursor, Google Jules/Gemini, Aider and Windsurf/Codeium, alongside Claude. It keys on each agent's vendor email / bot login (not bare names), so human co-authors are never blocked.
  • Bot review — fixed the YAML syntax error in the step name (the workflow now parses and runs) and awaited core.summary.write().
  • Signoff — the commit is now signed off; DCO passes.

On enforcing it in the agents themselves: contributing.md isn't reliable (agents don't read it / forget it), so the real fix-at-source is the Claude Code setting includeCoAuthoredBy: false — the check's failure message already points at it, and we can roll it out in the team Claude Code config plus a local commit-msg hook. This workflow is the backstop for whatever slips through.

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.

2 participants