Add mannequin bot reclaim support for customer owned bot accounts - #1605
Draft
dpmex4527 wants to merge 3 commits into
Draft
Add mannequin bot reclaim support for customer owned bot accounts#1605dpmex4527 wants to merge 3 commits into
dpmex4527 wants to merge 3 commits into
Conversation
Contributor
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
dpmex4527
force-pushed
the
dpmex4527/reclaim-mannequin-to-bot
branch
from
August 25, 2026 20:44
fe3aee8 to
454ddcb
Compare
Comment on lines
+1010
to
+1014
| return await _retryPolicy.Retry(async () => | ||
| { | ||
| var data = await _client.PostGraphQLAsync(url, payload); | ||
| return data.ToObject<ReattributeMannequinToBotResult>(); | ||
| }); |
Unit Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 454ddcb. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)