mirror of
https://github.com/openclaw/lobster.git
synced 2026-08-25 12:50:33 -04:00
[PR #9] fix: resolve ${VAR} templates against environment variables #9
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/openclaw/lobster/pull/9
Author: @JoshuaLelon
Created: 2/8/2026
Status: 🔄 Open
Base:
main← Head:feat/env-var-inheritance📝 Commits (1)
37083f2fix: resolve ${VAR} templates against environment variables📊 Changes
3 files changed (+184 additions, -9 deletions)
View changed files
📝
src/workflows/file.ts(+25 -9)➕
test/fixtures/env-test.lobster(+6 -0)➕
test/workflow_env.test.ts(+153 -0)📄 Description
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🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.