Where does the bug appear (feature/product)?
Background Agent (GitHub, Slack, Web, Linear)
Describe the Bug
Problem: The commit-msg.cursor.co-author hook skips adding the correct co-author if a Co-authored-by: line already exists in the commit message. The AI agent sometimes mimics Co-authored-by trailers it sees in git log, inserting the wrong user. The hook’s guard clause (grep -q “Co-authored-by:”) then exits early, so the platform-injected identity is never applied.
Steps to Reproduce
Example: User A triggers a Cloud Agent task from their PR. The hook is correctly provisioned with User A’s identity. However, the repo’s git history contains many prior agent commits co-authored by User B (the most frequent agent user). The AI mimics that pattern and writes Co-authored-by: User B into the commit message. The hook sees the existing trailer, exits early, and User A’s correct attribution is never applied.
Expected Behavior
User A should a be the co-author, not User B.
Operating System
MacOS
Version Information
n/a - this is happening in cloud agents
Does this stop you from using Cursor
No - Cursor works, but with this issue