feat(config): accept ${env.X} in path fields (steps 2-4 of #2615)#2944
Merged
Conversation
docker-agent
reviewed
Jun 1, 2026
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The diff was fully reviewed. No bugs or logic errors were found in the changed code.
Summary of changes reviewed:
pkg/path/expand.go: New${env.VAR}→${VAR}normalization via regex substitution beforeos.ExpandEnv. The regex and substitution logic are correct; backward-compatibility with existing$VAR/${VAR}/~is preserved.pkg/config/expansion_warnings.go: Removal of now-obsolete mismatch warnings for path fields is appropriate given the new dual-syntax support.pkg/path/expand_test.go/pkg/config/expansion_warnings_test.go: Test coverage for the new behaviour and updated warning set looks complete.- Documentation updates accurately describe the new dual-syntax support and variable-expansion matrix.
No issues found.
melmennaoui
approved these changes
Jun 1, 2026
d122622 to
27e7e15
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.
docker-agent has two incompatible environment variable expansion syntaxes: JavaScript template literals (
${env.X}) for prompt, header, and command fields, and shell-style ($VAR,${VAR},~) for path fields. Using the wrong syntax in a path field was silently ignored, tracked in #2615.This PR makes path fields accept both syntaxes.
pkg/path.ExpandPathnow normalizes the JavaScript form${env.VAR}to${VAR}before callingos.ExpandEnv, so toolsetworking_dir, path fields (memory and tasks path, mcp and lspworking_dir), and related fields accept either syntax. The change is fully backward-compatible — existing$VAR/${VAR}/~configurations are unchanged.Only plain
${env.VAR}references are supported in paths; richer expressions like${env.X || 'default'}are not evaluated (would require importing the goja engine, creating a circular dependency). Resolution uses the OS environment, matching the existing${X}behavior. The now-obsolete mismatch warnings forworking_dirand path fields have been removed frompkg/config/expansion_warnings.go. Warnings remain for truly shell-only fields: toolset env values,ScriptShellworking_dir/env, and hookworking_dir/env.This is a partial fix for #2615; a follow-up will address the remaining shell-only fields in step 5. Documentation has been updated with a new variable-expansion matrix and cross-reference comments on the duplicated regex.
Refs #2615