[v26.1.x] rpk/ai: don't require a cloud cluster to run the ai plugin - #31079
Merged
birdayz merged 1 commit intoJul 13, 2026
Merged
Conversation
`rpk ai <cmd>` died with
unable to prepare rpk ai invocation: no cluster selected for this
rpk profile; run 'rpk cloud cluster use <id>' or pass --rpai-endpoint
whenever no rpk cloud cluster was selected. Before exec'ing the plugin,
the managed-plugin hook resolved the AI Gateway endpoint from the
selected cloud cluster and injected it (plus the cached cloud token) as
RPAI_ENDPOINT / RPAI_TOKEN, and hard-failed when there was no cluster to
resolve from.
That injection is dead weight. The rpk ai plugin is self-contained: it
has its own login (`rpk ai auth login`) and its own environment
selection (`rpk ai env use`), and in plugin mode it deliberately ignores
an ambient RPAI_ENDPOINT and RPAI_TOKEN. So rpk was computing two values
the plugin throws away; the only observable effect left was a gate that
blocked the plugin from ever starting without a selected cluster --
including `rpk ai auth login`, the one command whose whole job is to
establish that context in the first place.
The gate also fired inconsistently (it depended on which dispatch path a
given invocation took), which is why it reproduced for some users and
not others.
Drop the injection entirely. rpk now only strips its own global flags
and execs the plugin, which owns auth and endpoint selection end to end.
(cherry picked from commit 6308e16)
r-vasquez
approved these changes
Jul 13, 2026
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.
Backport of PR #30990