fix: resolve ${VAR} templates against environment variables#9
Open
JoshuaLelon wants to merge 1 commit intoopenclaw:mainfrom
Open
fix: resolve ${VAR} templates against environment variables#9JoshuaLelon wants to merge 1 commit intoopenclaw:mainfrom
JoshuaLelon wants to merge 1 commit intoopenclaw:mainfrom
Conversation
resolveArgsTemplate() only looked up ${VAR} from workflow args, so
env: { MY_VAR: "${MY_VAR}" } produced the literal string instead of
the actual value. Thread the accumulated env through resolveTemplate,
resolveStdin, and resolveCwd so ${VAR} falls back to the process/
workflow environment when not found in args.
Also resolve relative cwd values against the workflow file directory.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
resolveArgsTemplate()only looked up${VAR}from workflow args (passed via--args-json), soenv: { MY_VAR: "${MY_VAR}" }in workflow YAML produced the literal string"${MY_VAR}"instead of the actual value fromprocess.env. This also affected${VAR}incommand,stdin, andcwdfields.The fix threads the accumulated environment through
resolveTemplate,resolveStdin, andresolveCwdso${VAR}falls back to the process/workflow environment when not found in args. Args still take precedence over env vars.Also adds relative
cwdresolution —cwd: ./scriptsnow resolves relative to the workflow file's directory instead of being passed as-is tospawn().lobster-biscuit
Repro Steps
env: { TEST_VAR: "${TEST_VAR}" }TEST_VAR=hello lobster run --file workflow.lobsterprocess.env.TEST_VARis the literal"${TEST_VAR}"instead of"hello"Root Cause
resolveArgsTemplateonly checkedargs(workflow-defined args from--args-json). It had no fallback to the environment, so any${VAR}not defined inargswas returned verbatim.Behavior Changes
${VAR}inenv,command,stdin, andcwdvalues now resolves from the environment when not found in workflow argscwdvalues (e.g../scripts) now resolve relative to the workflow file directory${VAR}still pass through as beforeTests
6 new tests in
test/workflow_env.test.ts:All 53 tests pass (47 existing + 6 new).
pnpm build && pnpm test— clean.Manual Testing
Sign-Off
envparams preserve backward compatibility