Add mannequin bot reclaim support for customer owned bot accounts - #1605
Add mannequin bot reclaim support for customer owned bot accounts#1605dpmex4527 wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds bot-account targets to mannequin reclaim workflows.
Changes:
- Resolves
[bot]targets through REST and invokes the bot reattribution mutation. - Adds irreversible-action confirmations, CSV support, and warnings.
- Adds models, tests, feature flag, and release notes.
Show a summary per file
| File | Description |
|---|---|
RELEASENOTES.md |
Documents bot reclaim support. |
ReclaimMannequinCommandHandler.cs |
Adds bot confirmations and CSV target parsing. |
ReclaimMannequinToBotResult.cs |
Defines mutation response models. |
GithubApi.cs |
Adds bot lookup and reattribution API calls. |
GithubClient.cs |
Enables the bot-claiming feature flag. |
ReclaimService.cs |
Routes bot targets through immediate reattribution. |
ReclaimMannequinCommandHandlerTests.cs |
Tests prompting behavior. |
GithubApiTests.cs |
Tests bot lookup and mutation handling. |
ReclaimServiceTests.cs |
Tests single bot-target reclaim routing. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Balanced
Adds bot-target support to mannequin reclamation.
- New GithubApi.ReattributeMannequinToBot calls the reattributeMannequinToBot GraphQL mutation for a customer-owned bot target.
- New GithubApi.GetBotId resolves a [bot] login to its GraphQL node id via the REST GET /users/{login} endpoint (the GraphQL user(login:) query hides bots).
- ReclaimService routes [bot]-suffixed targets to GetBotId + ReattributeMannequinToBot in both the single and CSV reclaim paths; human targets are unchanged.
- Adds the mannequin_claiming_bot GraphQL-Features header.
- Unit tests for GetBotId and bot routing; release notes.
Reattributing content to a bot auto-accepts and cannot be undone, so prompt for confirmation (skippable with --no-prompt) on both single and CSV reclaim paths, and emit an advisory warning when the source mannequin login does not look like a bot. Expose ReclaimService.IsBotLogin for reuse and clarify the org/enterprise wording in the not-enabled error.
- Trim parsed CSV fields before bot detection so a target with surrounding whitespace (e.g. "example-ci[bot] ") still triggers the irreversible-action confirmation, matching ReclaimService.ParseLine - Add a bulk-reclaim unit test verifying a CSV bot target calls GetBotId and ReattributeMannequinToBot and avoids the user invitation/skip-invitation paths
fe3aee8 to
454ddcb
Compare
Unit Test Results 1 files 1 suites 25s ⏱️ Results for commit d28abab. ♻️ This comment has been updated with latest results. |
reattributeMannequinToBot is irreversible and its failures (ineligible bot, insufficient ownership, feature disabled) are deterministic, so submit it once instead of through the retry policy to avoid resubmitting a duplicate mutation. Adds a test asserting the mutation is not retried on failure.
brianaj
left a comment
There was a problem hiding this comment.
What is the behavior for non-GH source migrations? I think we should have clear warnings this functionality is only for github [bot] in the command help and while running the command.
@brianaj great Q. The new behavior is an advisory warning indicating that the source mannequin does not look like a bot (missing There is future work we could do to strengthen/harden source mannequin bot detection (including passing info to our backend to indicate that a mannequin is truly a bot) but this would have significantly increased the scope of the work and would also not be backwards compatible with existing mannequin bot accounts that have already been imported (and that customers would want to reclaim). I'm happy to add/update our help commands to make this behavior clear. Would something like this be good? |
Got I think if other sources won't work as is (do we know their bot names) we should be more explicit that bot reclaims should only work from GitHub sources so ado/bbs/gitlab customers won't see it as a bug if it doesn't work for them. |
From what I've been able to see other sources should work as long as we don't block on not having |
|
@dpmex4527 got it, well as long as there is a disclaimer 👍🏾 |
- Mention advisory warning for mannequins not ending in [bot] and supporting non github bot sources
… bot reclaim support

This PR adds bot-target support to
gh gei reclaim-mannequin, so an organization admin or enterprise admin can reattribute migrated content from a bot mannequin to a customer-owned GitHub App / bot account (previously only human users were supported). Attribution to GitHub owned/first party apps is rejected on the backend.Context
Customers whose automation moved from machine-user "bot accounts" to GitHub Apps couldn't reclaim their apps' bot-authored content. The reclaim path resolves the target via the GraphQL
user(login:)query, which hides bots (it only resolves accounts whereuser?is true), so an app login likeexample-ci[bot]could not be resolved or reclaimed.Notable Changes
The CLI detects the
[bot]suffix on the target and routes to a newReattributeMannequinToBotmutation.Since bots can't be resolved through graphql, the CLI now uses rest API to fetch the bot gql ID
The new mutation is under feature flag so we pass the
mannequin_claiming_botfeature flag in theGraphQL-FeaturesheaderSince bots can't receive emails, there is no manual confirmation flow. Only org admins and enterprise admins can call the new mutation and this mutation immediately reattributes the mannequin to bot after passing ownership checks
Similar to the auto attribution process for users, the CLI displays prompts a confirmation step for both individual reclaim and CSV reclaim of bots warning users that mannequin reclamation is a one way step and that they need to confirm their intent to reclaim. It also has the
--no-promptflag to skip the prompt stepIf a user attempts to reclaim a mannequin bot that doesn't have the
[bot]suffix, a warning is displayed. We allow this because non GitHub sources don't use GitHub bot conventions and we still want customers to be able to reclaim ADO/BBS bot accountsDid you write/update appropriate tests
Release notes updated (if appropriate)
Appropriate logging output
Issue linked
Docs updated (or issue created)
New package licenses are added to
ThirdPartyNotices.txt(if applicable)Screenshots and functional testing
Reclaiming against target customer owned bot
Advisory warning when reclaiming against mannequin that doesn't end with [bot]
Reclaim against bot in another org fails