Skip to content

Remove legacy user generation label handling - #69335

Merged
strideynet merged 4 commits into
masterfrom
strideynet/remove-legacy-generation-label
Aug 11, 2026
Merged

Remove legacy user generation label handling#69335
strideynet merged 4 commits into
masterfrom
strideynet/remove-legacy-generation-label

Conversation

@strideynet

@strideynet strideynet commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Closes #64484

A long long time ago, we stored a generation counter on the Bot User as a label. Less long ago, we began to migrate to storing this generation counter on Bot Instances.

As part of this migration, we continued to write the legacy generation counter label (to support downgrade paths gracefully) and included logic which would create a Bot Instance, if one did not exist, from the bot user label. This migration began in #44583 - and began without an experiment flag in v17.0.0.

From this PR onwards:

  • We no longer write the generation counter label.
  • We no longer restore Bot Instances from the generation counter label.
  • If the BotInstance cannot be found, this is treated as a generation mismatch for Token and Bound Keypair joining and triggers a lock of the join token.

I also took this opportunity to clean up the updateBotInstance method - this had become very difficult to understand and had a number of branches. As the migration to Bot Instances took place long enough ago, we can now safely assume things like the Generation and BotInstanceID will be encoded in identities.

Open question:

Is treating BotInstance not found as a generation mismatch (and hence a lock for Token/Bound Keypair joining) reasonable? Locking the join token is quite a drastic action and prevents self-recovery (for bound keypair). I went with this approach in the PR, since it most closely tracks the existing behaviour today.

As far as I can tell, there are two cases where we may expect the BotInstance to not be found:

  • Administrative rollback of the database (or disaster recovery)
  • Administrator invokes DeleteBotInstance RPC.

It seems increasingly reasonable to me that we may wish to treat this as an error and reject the renewal without locking. This would allow self-recovery for Bound Keypair. However, I do believe this would be better explored in a separate PR as this would constitute a change in behaviour and security model. We would need to ensure that the Bound Keypair logic can handle the underlying layers changing the BotInstanceID. It doesn't necessarily resolve the problem either - since generation mismatch would be triggered if the BotInstance was rolled back to a prior counter value (and not non-existent).

Changelog:

Manual Test Plan

Test Environment

Local cluster

Test Cases

  • Renew Bot Instance from prior version:
    • Token
    • Bound Keypair
    • Kubernetes
  • Join Bot Instance:
    • Token
    • Bound Keypair
    • Kubernetes

Agentic test plan: https://gist.github.com/strideynet/f2c237c0652cce84bab1b2d2a8303b9d

@strideynet
strideynet changed the base branch from master to strideynet/fix-delegated-bot-instance-missing August 4, 2026 18:36
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
strideynet/remove-legacy-generation-label bb4bd8d 9 ✅SUCCEED strideynet-remove-legacy-generation-label 2026-08-10 12:01:53

Preview links for changed docs pages

Comment thread lib/auth/bot.go
Base automatically changed from strideynet/fix-delegated-bot-instance-missing to master August 5, 2026 10:35
@strideynet
strideynet force-pushed the strideynet/remove-legacy-generation-label branch from 085a483 to 2412e14 Compare August 5, 2026 11:06
@strideynet
strideynet force-pushed the strideynet/remove-legacy-generation-label branch from 04a54c2 to 351c592 Compare August 5, 2026 12:56

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

Nice to see the legacy counter gone!

Comment thread lib/auth/bot.go
@strideynet strideynet added the no-changelog Indicates that a PR does not require a changelog entry label Aug 11, 2026
@strideynet
strideynet added this pull request to the merge queue Aug 11, 2026
Merged via the queue into master with commit b888160 Aug 11, 2026
64 of 78 checks passed
@strideynet
strideynet deleted the strideynet/remove-legacy-generation-label branch August 11, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation no-changelog Indicates that a PR does not require a changelog entry size/sm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MWI: Finish removal of legacy generation label code

4 participants