Skip to content

fix: PR fingerprint check blocks plain-text mentions of Cursor/Copilot#279

Merged
c-vigo merged 4 commits intorelease/0.3.0from
bugfix/274-ai-fingerprint-block
Mar 12, 2026
Merged

fix: PR fingerprint check blocks plain-text mentions of Cursor/Copilot#279
c-vigo merged 4 commits intorelease/0.3.0from
bugfix/274-ai-fingerprint-block

Conversation

@c-vigo
Copy link
Contributor

@c-vigo c-vigo commented Mar 12, 2026

Description

The PR fingerprint check (check-pr-agent-fingerprints) produces false positives when normal prose mentions AI tool names like "Cursor" or "Copilot". The root cause is case-insensitive substring matching of names against the entire PR title+body.

This PR narrows name matching to attribution-context lines only and wires up the previously unused allow_patterns from agent-blocklist.toml.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • packages/vig-utils/src/vig_utils/utils.py
    • load_blocklist: now loads allow_patterns from TOML as compiled regexes
    • contains_agent_fingerprint: strips allow_patterns matches from content before checking; restricts names matching to lines containing attribution-context phrases (authored by, generated by, powered by, bot, agent, etc.)
    • New module-level _ATTRIBUTION_CONTEXT_RE compiled regex
  • packages/vig-utils/tests/test_utils.py
    • 8 new tests in TestAgentBlocklistHelpers: allow_patterns loading, plain-prose pass-through, attribution-context blocking, allow_patterns stripping, combined stripping+attribution, email unconditional matching
  • CHANGELOG.md
    • Added entry under ### Fixed in [0.3.0]

Changelog Entry

Fixed

  • PR fingerprint check false positives on plain-text AI tool mentions (#274)
    • contains_agent_fingerprint now restricts name matching to attribution-context lines (e.g. "generated by", "authored by") instead of scanning the entire content
    • Wire up allow_patterns from agent-blocklist.toml to strip known-safe text (dotfile paths, doc filenames) before checking

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

N/A

Refs: #221, #274

c-vigo added 2 commits March 12, 2026 14:43
Tests cover:
- allow_patterns loading from TOML
- plain-prose name mentions pass through (the false-positive repro)
- attribution-context phrases still blocked
- allow_patterns stripping before name matching
- email matching stays unconditional

Refs: #274
load_blocklist now loads allow_patterns from the TOML as compiled
regexes. contains_agent_fingerprint strips allow_patterns matches
before checking and only flags names on lines containing attribution
phrases (authored/generated/created/powered by, bot, agent, etc.).

Emails and trailers keep their existing matching behaviour.

Refs: #274
@c-vigo c-vigo self-assigned this Mar 12, 2026
@c-vigo c-vigo requested a review from Copilot March 12, 2026 13:50
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts the PR title/body AI-agent fingerprint detection used by check-pr-agent-fingerprints to avoid false positives from plain-prose mentions of tool names (e.g., “Cursor”, “Copilot”), and activates the previously-configured allow_patterns support from the blocklist TOML.

Changes:

  • Load allow_patterns from agent-blocklist.toml and apply them by stripping known-safe text before scanning.
  • Restrict names matching to lines that appear to be attribution/agent-identity context (instead of scanning the entire content).
  • Add unit tests covering allow-pattern loading/stripping and attribution-vs-prose behavior; add changelog entry for the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/vig-utils/src/vig_utils/utils.py Loads/uses allow_patterns and narrows name matching to attribution-context lines via a new regex.
packages/vig-utils/tests/test_utils.py Adds tests to prevent regressions for plain-prose mentions and verify allow-pattern stripping behavior.
CHANGELOG.md Documents the fix under the current release’s “Fixed” section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

c-vigo added 2 commits March 12, 2026 14:55
The validate-commit-msg step ran without --blocked-patterns, falling
through to a hardcoded fallback that does not apply attribution-context
filtering. Pass the canonical blocklist so the fixed code path is used.

Skipping TDD: CI workflow config change, not unit-testable.

Refs: #274
The standalone words "bot", "agent", "assistant" triggered false
positives when they appeared in compound terms like
"check-pr-agent-fingerprints" on a line that also mentioned a
blocked name. Restrict the context regex to explicit "X by" phrases
which are specific enough to catch genuine attribution.

Refs: #274
@c-vigo c-vigo merged commit 382fc6c into release/0.3.0 Mar 12, 2026
6 checks passed
@c-vigo c-vigo deleted the bugfix/274-ai-fingerprint-block branch March 12, 2026 14:02
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