Skip to content

Add mannequin bot reclaim support for customer owned bot accounts - #1605

Draft
dpmex4527 wants to merge 3 commits into
mainfrom
dpmex4527/reclaim-mannequin-to-bot
Draft

Add mannequin bot reclaim support for customer owned bot accounts#1605
dpmex4527 wants to merge 3 commits into
mainfrom
dpmex4527/reclaim-mannequin-to-bot

Conversation

@dpmex4527

Copy link
Copy Markdown
Member

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 where user? is true), so an app login like example-ci[bot] could not be resolved or reclaimed.

Notable Changes

  • The CLI detects the [bot] suffix on the target and routes to a new ReattributeMannequinToBot mutation.

  • 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_bot feature flag in the GraphQL-Features header

  • Since 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-prompt flag to skip the prompt step

  • If 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 accounts

  • Did 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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/Octoshift/Commands/ReclaimMannequin/ReclaimMannequinCommandHandler.cs Outdated
Comment thread src/Octoshift/Services/ReclaimService.cs
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
dpmex4527 force-pushed the dpmex4527/reclaim-mannequin-to-bot branch from fe3aee8 to 454ddcb Compare August 25, 2026 20:44
@dpmex4527
dpmex4527 requested a balanced review from Copilot August 25, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 9/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +1010 to +1014
return await _retryPolicy.Retry(async () =>
{
var data = await _client.PostGraphQLAsync(url, payload);
return data.ToObject<ReattributeMannequinToBotResult>();
});
@github-actions

Copy link
Copy Markdown

Unit Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 454ddcb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants