feat(config): accept ${env.X} in toolset env values (#2615)#3257
Merged
Conversation
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The PR correctly implements NormalizeEnvRefs to rewrite ${env.X} → ${X} before os.Expand, and integrates it cleanly in both pkg/path/expand.go and pkg/environment/expand.go. The regex replacement string ${\} is valid Go regexp syntax and produces the expected output. The warning removal and warnPathField → warnExecField rename are consistent with the change. No bugs introduced by this PR were found.
aheritier
approved these changes
Jun 26, 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.
Toolset
envvalues previously only understood the shell-style${X}expansion syntax. When an agent config used the JS-template form${env.X}— which already works in path fields likeworking_dirandpath— the runtime would reject it with a hard "environment variable not set" error, silently breaking configs that mixed both styles. This is the first part of fixing the inconsistency tracked in #2615.The fix extracts a shared
NormalizeEnvRefshelper inpkg/path/expand.gothat rewrites${env.X}to${X}before expansion, then calls it frompkg/environment/expand.goahead ofos.Expand. Richer JS expressions such as${env.VAR || 'default'}are intentionally not evaluated in env values — only the plain${env.X}alias is handled. The variable-expansion quick-reference table indocs/configuration/overview/index.mdhas been updated to reflect that env values now accept both forms.A related cleanup drops the now-obsolete startup warning that flagged
${env.X}in toolset env values. The warning helper for shell and hook fields — which are forwarded verbatim toexec.Cmdwith no expansion at all — was renamedwarnPathField→warnExecFieldand its message corrected; the old message incorrectly told users to switch to${X}or$X, neither of which is substituted in those fields.