Skip to content

docs: enforce Assisted-By attribution in PR descriptions - #654

Merged
pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:chore/pr-assisted-by-attribution
Oct 28, 2026
Merged

pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:chore/pr-assisted-by-attribution

Conversation

@pdettori

@pdettori pdettori commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

PR descriptions had no attribution guard: the default Claude Code vendor footer (the robot-emoji line and its "...with Claude Code" wording) reaches PR bodies, while commits are already rewritten to Assisted-By by scripts/hooks/commit-msg.

This PR adds three layers, matching how the commit side is already handled:

  • CLAUDE.md — new PR Description Attribution section. Claude Code reads CLAUDE.md every session, so naming the exact forbidden strings and the exact replacement (Assisted-By: Claude Code) makes the override deterministic for every contributor's session, not just Paolo's global config.
  • CONTRIBUTING.md — new Attribution section for humans: commits are handled automatically by the hook; PR bodies are a manual rule (delete any tool-inserted footer, use Assisted-By: Claude Code).
  • .github/workflows/pr-attribution.yml — CI check that rejects PR bodies containing the prohibited footers. Reads the body from the event payload, so no checkout, no actions, no token (permissions: {}), and it works unchanged for fork PRs. Triggers on opened/edited/reopened/synchronize so it reports on every head SHA (safe to mark required). Empty PR descriptions pass.

Grep logic tested against the footer variants (plain, markdown-link, emoji-only, Made-with:) and clean/prose bodies (Fixes the 🤖 bot labeler, home-made-with care, Made-without-tests).

Known limitation

The with-claude phrases match anywhere in the body, so a description quoting them verbatim (as an earlier draft of this one did — the check correctly failed it) must paraphrase instead. The emoji and Made-with: patterns are line-anchored, so mentioning them mid-sentence is safe. Only the body is scanned, never the diff, so editing CONTRIBUTING.md or CLAUDE.md text is unaffected.

Assisted-By: Claude Code

PR descriptions had no attribution guard: Claude Code's default
'Generated with Claude Code' / 🤖 footer was reaching PRs, while commits
are already rewritten to Assisted-By by scripts/hooks/commit-msg.

- CLAUDE.md: add a PR Description Attribution section so every
  contributor's Claude Code session overrides the default footer
- CONTRIBUTING.md: add an Attribution section covering both commits
  (hook-handled) and PR bodies (manual rule)
- .github/workflows/pr-attribution.yml: CI check that rejects PR bodies
  containing the prohibited footers; reads the event payload so it needs
  no checkout or token and works for fork PRs

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 28, 2026

@ingpaolodettori-dev ingpaolodettori-dev 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.

Summary

This adds a PR-body attribution rule to CLAUDE.md and CONTRIBUTING.md, plus a small pull_request workflow that fails on prohibited AI-attribution footers. The workflow is safe: the body goes through env: (no ${{ }} in run:), it needs no checkout, no third-party actions and no token, and it works for forks. No blocking issues. I have three suggestions. The workflow only triggers on opened/edited, so it never reports on new pushes. The unanchored 🤖 / made-with patterns false-positive on ordinary prose. And CONTRIBUTING describes the commit-msg hook slightly inaccurately.

Author: pdettori (MEMBER — maintainer)
Areas reviewed: CI/GitHub Actions, Docs, agent instructions (CLAUDE.md)
Agent/IDE config (.claude/.vscode): none
Commits: 1 commit, all signed-off: yes
CI status: passing (incl. the new PR attribution / check on this PR)

Comment thread .github/workflows/pr-attribution.yml Outdated

on:
pull_request:
types: [opened, edited]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: The opened/edited trigger is fine if this is only advisory. If you mark PR attribution / check as a required status check, it breaks, because required checks are tied to the head SHA. After any new push (synchronize) or a reopened, no run exists for the new head, and the PR waits on a check that never reports. The job takes about 3 seconds, so I'd use types: [opened, edited, reopened, synchronize] and drop the line in the header comment saying the body doesn't change on new pushes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 1653bf5 — triggers are now [opened, edited, reopened, synchronize] and the comment line is dropped. Required checks being head-SHA-tied was the gap; at ~3s per run, synchronize is cheap.

Comment thread .github/workflows/pr-attribution.yml Outdated

# Same forbidden strings as the PR Description Attribution section in
# CLAUDE.md / CONTRIBUTING.md. Assisted-By is the accepted form.
if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: Two of these alternatives are unanchored substrings, so they reject ordinary descriptions:

  • 🤖 anywhere fails e.g. "Fixes the 🤖 bot labeler" or a pasted Dependabot/Renovate snippet.
  • made-with matches Made-without-tests, home-made-with, and so on.

Anchoring the emoji and Made-with: to the start of a line still catches every footer variant the PR body lists. I tested this locally:

Suggested change
if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then
if body | grep -qiE '(generated|created|made) with \[?claude|^[[:space:]]*made-with:|^[[:space:]]*🤖'; then

It fails on 🤖 Generated with [Claude Code](…), a bare 🤖, Made-with: Cursor, and Generated with Claude Code. It passes on Fixes the 🤖 bot labeler, home-made-with care, and Assisted-By: Claude Code. It also narrows the self-quoting limitation you describe to quotes that start a line or use the exact phrase.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Adopted your regex verbatim in 1653bf5. Tested against 13 vectors — all footer variants reject (emoji-only, markdown-link, Made-with: Cursor, plain); prose (Fixes the 🤖 bot labeler, home-made-with care, Made-without-tests), Assisted-By, and empty bodies pass.

Comment thread .github/workflows/pr-attribution.yml Outdated
types: [opened, edited]

permissions:
contents: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: The step only reads the event payload, so it needs no token scopes. permissions: {} would match security-scans.yml and the "no token" claim in the header comment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 1653bf5 — permissions: {}, matching security-scans.yml.

Comment thread .github/workflows/pr-attribution.yml Outdated
# CLAUDE.md / CONTRIBUTING.md. Assisted-By is the accepted form.
if body | grep -qiE 'generated with claude|created with claude|made with claude|made-with|🤖'; then
echo "::error::PR description contains a prohibited AI-attribution footer."
echo "::error::Remove 'Generated with Claude Code' / 'Created with Claude Code' / the 🤖 line, and use 'Assisted-By: Claude Code' instead (see CONTRIBUTING.md, Attribution)."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: The error message doesn't mention Made-with, but the check rejects it. Add it to the list so a failing author knows what to remove.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added in 1653bf5.

Comment thread CONTRIBUTING.md Outdated
GitHub parses as co-authorship (they inflate contributor stats):

- **Commits**: the `commit-msg` hook installed by `pre-commit install` rewrites
`Co-authored-by:` and `Made-with:` lines naming an AI to a single

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: This doesn't quite match scripts/hooks/commit-msg on main:

  • Made-with: lines are stripped whether or not they name an AI. They don't trigger the Assisted-By trailer. That's only added when a Co-authored-by: line matches Claude|Cursor|anthropic. So a commit whose only marker is Made-with: Cursor ends up with no attribution.
  • "naming an AI" only covers Claude, Cursor, and Anthropic.

Suggested wording: "strips Made-with: lines and replaces Co-authored-by: trailers naming Claude, Cursor, or Anthropic with a single Assisted-By: … trailer". Alternatively, make the hook set HAS_AI_TRAILER on Made-with: too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Took the wording fix in 1653bf5. Left the hook unchanged — making Made-with: set HAS_AI_TRAILER changes commit-msg behavior and is out of scope for a docs PR; happy to do it as a follow-up if you want Made-with: Cursor commits to get an Assisted-By trailer.

… hook wording

- workflow: add synchronize/reopened triggers so the check reports on
  every head SHA (required status checks hang on pushes with no run);
  drop the now-wrong 'body does not change on new pushes' comment
- workflow: anchor 🤖 and Made-with to line start so ordinary prose
  ('Fixes the 🤖 bot labeler', 'home-made-with care') does not trip the
  check; tested against footer and prose vectors
- workflow: permissions: {} (no checkout, no actions, no token) to match
  security-scans.yml; list Made-with in the error message
- CONTRIBUTING: describe scripts/hooks/commit-msg accurately — it strips
  Made-with lines unconditionally and only adds Assisted-By for
  Co-authored-by trailers naming Claude, Cursor, or Anthropic

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit bdab08d into rossoctl:main Oct 28, 2026
16 checks passed
@pdettori
pdettori deleted the chore/pr-assisted-by-attribution branch October 28, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants