Skip to content

Add AI co-author support for commits#296435

Merged
dmitrivMS merged 12 commits intomainfrom
dev/dmitriv/add-ai-co-author
Feb 24, 2026
Merged

Add AI co-author support for commits#296435
dmitrivMS merged 12 commits intomainfrom
dev/dmitriv/add-ai-co-author

Conversation

@dmitrivMS
Copy link
Copy Markdown
Contributor

Fixes #266584
Fixes #50090

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

@dmitrivMS dmitrivMS added this to the February 2026 milestone Feb 20, 2026
@dmitrivMS dmitrivMS requested review from hediet and lszomoru February 20, 2026 03:19
@dmitrivMS dmitrivMS self-assigned this Feb 20, 2026
Copilot AI review requested due to automatic review settings February 20, 2026 03:19
@dmitrivMS dmitrivMS added git GIT issues scm General SCM compound issues labels Feb 20, 2026
@dmitrivMS dmitrivMS enabled auto-merge (squash) February 20, 2026 03:19
Copy link
Copy Markdown
Contributor

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

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 AiContributionFeature to 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.addAICoAuthor setting 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);

Comment thread extensions/git/src/repository.ts
Comment thread src/vs/workbench/contrib/editTelemetry/browser/editTelemetryContribution.ts Outdated
Comment thread extensions/git/src/repository.ts
Comment thread src/vs/workbench/contrib/editTelemetry/browser/aiContributionFeature.ts Outdated
Comment thread extensions/git/src/hover.ts Outdated
Comment thread extensions/git/src/repository.ts
Comment thread extensions/git/src/git.ts
Comment thread build/lib/policies/policyData.jsonc Outdated
Comment thread product.json Outdated
@dmitrivMS dmitrivMS changed the title feat: add AI co-author support for commits Add AI co-author support for commits Feb 23, 2026
@dmitrivMS
Copy link
Copy Markdown
Contributor Author

@joshspicer With policy reverted, the tests are failing now. Would you like me to revert the entire policy change?

@microsoft microsoft deleted a comment from andrei-cb Feb 23, 2026
joaomoreno
joaomoreno previously approved these changes Feb 23, 2026
@TylerLeonhardt
Copy link
Copy Markdown
Member

If I use:

  • Local
  • Copilot CLI (aka Background)
  • Claude
image

What's the expected Co-author?

I could see:

  • Local - either VS Code or Copilot (ideally the former)
  • Copilot CLI - clearly Copilot
  • Claude - Claude... but I guess it could be Copilot since Copilot provides the subscription but it feels weird to use Claude's Agent SDK & Claude's LLMs and then slap a "Co-Authored By Copilot" on that

@dmitrivMS
Copy link
Copy Markdown
Contributor Author

@TylerLeonhardt Right now it's always Copilot. What is your expectation for these scenarios?

@dmitrivMS dmitrivMS merged commit 0fb7719 into main Feb 24, 2026
20 checks passed
@dmitrivMS dmitrivMS deleted the dev/dmitriv/add-ai-co-author branch February 24, 2026 02:57
@legowerewolf
Copy link
Copy Markdown

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

@dmitrivMS
Copy link
Copy Markdown
Contributor Author

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).

@OrenMe
Copy link
Copy Markdown
Contributor

OrenMe commented Feb 24, 2026

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

@dmitrivMS
Copy link
Copy Markdown
Contributor Author

@OrenMe If those tools add co-author, it will be shown. I need to check if they do though - some do this already.

@OrenMe
Copy link
Copy Markdown
Contributor

OrenMe commented Feb 25, 2026

@OrenMe If those tools add co-author, it will be shown. I need to check if they do though - some do this already.

Thanks!
So if for example I work with agent mode and have code changes and then I go to GitHub Desktop app or other 3rd party app for git mng and I commit and push my code u track it on git level and add the co author? If so this is really good!

@dmitrivMS
Copy link
Copy Markdown
Contributor Author

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

@OrenMe
Copy link
Copy Markdown
Contributor

OrenMe commented Feb 26, 2026

Thanks @dmitrivMS that's what I thought but wasn't sure after your previous reply
This is a great feature but I'm afraid most people don't use the vscode internal git menus...

@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Apr 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

git GIT issues scm General SCM compound issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git - Add setting to include 'Co-authored-by:' commit trailer when AI codegen was used Git - Support Co-Authored-By

8 participants