ai-assistant: Let the model target a cluster by name - #1291
Open
tejhan wants to merge 1 commit into
Open
Conversation
tejhan
requested review from
ashu8912,
illume,
joaquimrocha,
skoeva,
sniok,
vyncent-t and
yolossn
as code owners
September 10, 2026 16:25
Signed-off-by: Tejhan <tejhan.diallo@gmail.com>
tejhan
force-pushed
the
ai-assistant-cluster-targeting
branch
from
September 10, 2026 16:29
64dbb39 to
b145ead
Compare
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.
Description
From the Home screen, the assistant ignores which cluster you ask about and answers using whatever cluster the host defaults to.
For instance, with the kubeconfig on cluster-2, the prompt "tell me about cluster-1" returns cluster-2's data, many times with no indication anything was substituted. I've attached a screenshot below of an example of the broken behavior:
(In this instance, I've created the
clus-2-nsina-test-cluster-2to highlight that we're fetching from the wrong cluster, even though my prompt specifiesa-test-cluster-1)This issue can surface in many different permutations. You can ask about different clusters, different resources, anything, but the underlying assistant will still perform queries on the default cluster, so even if it's not the cluster referred to in the prompt, the data for the default one still surfaces.
Cause
The cause is that
kubernetes_api_requestonly acceptsurl,method, andbody. The model has no way to explicitly name a cluster, somodal.tsxpicks one viatargetCluster || selectedClusters[0] || getCluster() || Object.keys(clusters)[0]. When inside a cluster viewgetCluster()returns the right answer, which is why this only shows up from Home.Changes
buildContextDescription.ts: Now lists the available clusters when none is selected, so the model knows what it can passKubernetesTool.ts: Asdded optionalclusterarg, passed through on reads & saved for the confirm dialog when writing.modal.tsx: Now only auto-pick when exactly one cluster is configuredclusterarg & associated context changesNote: Both of the new params are optional, so in-cluster and single-cluster behaviour should remain unchanged.
Testing: