chore(script): extend check_ai_attribution to scan commit messages#81
Merged
Conversation
The file-content scan only catches attribution checked in to tracked files. Agents that follow the default `Co-Authored-By: <AI tool>` git trailer slip past it. Scan commit-message bodies of commits ahead of the base ref (default origin/main, override via AI_ATTRIBUTION_BASE_REF) against the same patterns. Output prefixes commit-message findings with `[commit-msg <sha>]` so they're distinguishable from file-content hits at a glance. The scan no-ops when no usable base ref exists (fresh clone, detached HEAD on the base itself), preserving the existing behavior for that case. Use --pretty=tformat:%H so each SHA is newline-terminated for the while-read loop (--pretty=format:%H omits the trailing newline and the last record would not be read).
Contributor
There was a problem hiding this comment.
Pull request overview
Extends script/check_ai_attribution so the AI-attribution guard also scans commit message bodies (for commits ahead of a detected base ref) in addition to the existing tracked-file content scan, preventing “Co-Authored-By: …” trailers from slipping through.
Changes:
- Auto-detect a base ref (or allow override via
AI_ATTRIBUTION_BASE_REF) and scanbase_ref..HEADcommit message bodies. - Reuse the existing attribution regex pattern set for commit-message scanning.
- Prefix commit-message findings with
[commit-msg <sha>]for source clarity.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot stopped work on behalf of
BunsDev due to an error
May 20, 2026 23:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`./script/check_ai_attribution` currently scans only tracked file content for AI-attribution patterns. Agentic sessions that follow the default `Co-Authored-By: Claude` git trailer slip past it — the attribution lives in commit metadata, not in any file.
This change adds a second pass that scans commit-message bodies of commits ahead of the base ref against the same pattern set the file scan already uses.
Motivation
A concurrent `claude --dangerously-skip-permissions` session in this repo landed commit `6872184f fix(warpui/mac): preserve subview click cycles in WarpWindow sendEvent` on branch `castcodes/fix-browser-hittest` with a trailing `Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com` line. The existing guard reported "AI attribution guard passed." against that branch because it never inspects `git log`.
Test plan
Notes