Add AI co-author support for commits#296435
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for automatically including an AI co-author trailer (Co-authored-by: Copilot <copilot@github.com>) in git commit messages when AI-generated code is being committed. The feature addresses two long-standing issues: automatically attributing AI-generated code contributions (#266584) and supporting Co-Authored-By trailers in general (#50090).
Changes:
- Adds
AiContributionFeatureto track AI-generated edits across open documents using the existing edit telemetry pipeline - Integrates with git extension to append AI co-author trailer when committing files with tracked AI contributions
- Adds
git.addAICoAuthorsetting with three modes: 'off', 'chatAndAgent', and 'all' (for inline completions) - Implements co-author parsing in git log to display co-authors in hover tooltips and history
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/editTelemetry/browser/aiContributionFeature.ts | New feature class that tracks AI edits and exposes internal commands for querying/clearing AI contributions |
| src/vs/workbench/contrib/editTelemetry/browser/editTelemetryContribution.ts | Integrates AiContributionFeature when git.addAICoAuthor setting is enabled |
| extensions/git/src/repository.ts | Adds logic to append AI co-author trailer before commit and clear tracking after commit/revert/checkout operations |
| extensions/git/src/git.ts | Adds CoAuthor interface and parseCoAuthors function to extract co-authors from commit messages |
| extensions/git/src/hover.ts | Updates hover display to show co-authors with proper formatting |
| extensions/git/src/historyProvider.ts | Passes co-authors to history item hover |
| extensions/git/src/blame.ts | Passes co-authors to blame hover |
| extensions/git/package.json | Adds git.addAICoAuthor configuration setting |
| extensions/git/package.nls.json | Adds localized strings for the new setting |
| extensions/git/src/test/git.test.ts | Updates existing tests to include empty coAuthors arrays and adds comprehensive tests for parseCoAuthors |
| product.json | Adds policy configuration for git.addAICoAuthor setting |
Comments suppressed due to low confidence (1)
extensions/git/src/repository.ts:1417
- The command execution calls to clear AI contributions are fire-and-forget (not awaited), which means errors are silently ignored. However, the clearing should ideally happen before the commit completes to ensure tracking state is consistent. Consider awaiting these calls or at least adding error handling to log failures.
// Clear AI contribution tracking for committed resources
commands.executeCommand('_aiEdits.clearAiContributions', resources);
|
@joshspicer With policy reverted, the tests are failing now. Would you like me to revert the entire policy change? |
|
@TylerLeonhardt Right now it's always Copilot. What is your expectation for these scenarios? |
I was watching on #50090, and I mostly care about human co-authors, but I'd expect more specific details about what model/models were involved in making a specific commit. Regarding human co-authors, I'd appreciate support for automatically adding credits to VS Live Share participants who've made changes. |
|
Co-authors in Git should be shown with this change as well, but it only adds Copilot right now. We can make additional changes to tune it and/or handle more scenarios of course (live Live Share). |
|
This will only work when using vscode git menu right? I can't use it via GitHub desktop or the cli otherwise the co author won't be included |
|
@OrenMe If those tools add co-author, it will be shown. I need to check if they do though - some do this already. |
Thanks! |
|
@OrenMe Umm no, not in that scenarios. If you commit from VS Code session, it will append the tailer - outside tools (including command line) would not have this information. I wonder if there is a way to somehow record it... need to search this more. |
|
Thanks @dmitrivMS that's what I thought but wasn't sure after your previous reply |

Fixes #266584
Fixes #50090
Using edit telemetry tracking to populate Co-Author commit trailer.
Added setting and policy configuration for the new functionality.