fix(controller): keep user env vars over controller defaults - #2327
Open
mesutoezdil wants to merge 19 commits into
Open
fix(controller): keep user env vars over controller defaults#2327mesutoezdil wants to merge 19 commits into
mesutoezdil wants to merge 19 commits into
Conversation
Agent env was built as user env then shared env appended after it. Same name in both means the shared value wins on the pod, since k8s takes the last entry. A user setting OTEL_SERVICE_NAME or similar on their own agent got silently overwritten by the controller default. Now shared entries are only added if the user did not already set that name. Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
0809android
reviewed
Aug 10, 2026
0809android
left a comment
There was a problem hiding this comment.
Please keep the controller-owned identity variables authoritative. sharedEnv also contains KAGENT_NAME, KAGENT_NAMESPACE, and KAGENT_URL, so this merge lets spec.deployment.env replace them. KAgentConfig.app_name uses the first two as agent_ref; HandleCreateSession then requires that ref to match a registered Agent. For example, KAGENT_NAME=custom on kagent/my-agent produces kagent__NS__custom and session creation fails as an invalid agent ref. I reproduced that merge on this head with a focused Go test. Could overrides be limited to propagated OTEL_* values while preserving controller-owned values?
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.
Agent env was built as user env then shared env appended after it. Same name in both means the shared value wins on the pod, since k8s takes the last entry for duplicate names. A user setting OTEL_SERVICE_NAME or KAGENT_NAME on their own agent got silently overwritten by the controller default, no error or warning.
Now shared entries are only added if the user did not already set that name, so the user's own value always wins.
Added a unit test covering the collision case.