Repository navigation
Description
Before submitting
- I have searched existing issues to confirm this is not a duplicate
- I am running the latest version of Devsy
What happened?
When a --workspace-env (or --workspace-env-file) value contains =, devcontainer lifecycle hooks (postCreateCommand, postStartCommand) receive only the text before the next =. For ONE_EQ=a=b the hook sees a.
The full value is intact everywhere else. /etc/envfile.json and devsy workspace ssh sessions both see a=b. Only the lifecycle hook environment is affected, and nothing is logged.
The cause is patchEnvVars in pkg/devcontainer/config/prepareprobe.go:
t := strings.Split(v, "=")
newEnv[t[0]] = t[1]
This keeps only the text between the first and second =. It is applied to the environment of the userEnvProbe command, which feeds the hooks. Replacing it with strings. Cut and re-running the repro above makes every value come through intact in both hooks.
What did you expect to happen instead?
Hooks see the same value as every other path: everything after the first =.
devsy env set already keeps additional = characters in values (see #1431), so this looks like an inconsistency rather than a documented limit.
Steps to reproduce
- Create ws/.devcontainer/devcontainer.json and ws/.devcontainer/dump.sh (below), and an
envfile:
FILE_ONE_EQ=k=v
dump.sh:
#!/usr/bin/env bash
out=/tmp/env-repro-$1.txt
for v in PLAIN ONE_EQ TWO_EQ COMMA_EQ TRAILING_EQ FILE_ONE_EQ; do
printf '%s=[%s]\n' "$v" "${!v-<unset>}"
done > "$out"
export DEVSY_HOME=$HOME/.devsy-envrepro DEVSY_DISABLE_TELEMETRY=true
devsy provider add docker
devsy workspace up ./ws --provider docker --id env-repro --ide none \
--workspace-env "PLAIN=hello" \
--workspace-env "ONE_EQ=a=b" \
--workspace-env "TWO_EQ=a=b=c" \
--workspace-env "COMMA_EQ=x=1,y=2" \
--workspace-env "TRAILING_EQ=z=" \
--workspace-env-file ./envfile
- In the container, read /tmp/env-repro-postCreate.txt and /tmp/env-repro-postStart.txt, and compare with /etc/envfile.json and devsy workspace ssh env-repro.
devcontainer.json
{
"name": "env-repro",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
"postCreateCommand": "bash .devcontainer/dump.sh postCreate",
"postStartCommand": "bash .devcontainer/dump.sh postStart"
}Error output / logs
No error is logged.
Variable Passed Hooks /etc/envfile.json workspace ssh
PLAIN hello hello hello hello
ONE_EQ a=b a a=b a=b
TWO_EQ a=b=c a a=b=c a=b=c
COMMA_EQ x=1,y=2 x x=1,y=2 x=1,y=2
TRAILING_EQ z= z z= z=
FILE_ONE_EQ k=v k k=v k=vHow often does this happen?
Every time
Operating system
macOS
Linux distribution (if applicable)
No response
Architecture
ARM64
Desktop app or CLI?
CLI only
Devsy version
v1.24.0
Devsy provider
Docker
Provider version
v1.0.0
Screenshots
No response
Anything else?
Workaround: percent-encode = before passing the value and decode it in the hook, or read the full value from /etc/envfile.json.
Suggested fix:
func patchEnvVars(env []string, patches map[string]string) []string {
newEnv := map[string]string{}
for _, v := range env {
- t := strings.Split(v, "=")
- newEnv[t[0]] = t[1]
+ name, value, ok := strings.Cut(v, "=")
+ if !ok {
+ continue
+ }
+ newEnv[name] = value
}
Activity
fix: preserve lifecycle environment values containing equals signs (#…
skevetter commentedon Oct 31, 2026
Cleanup audit and remaining delivery plan
Status: the reported parser bug is fixed in source and included in a published prerelease. The remaining work is artifact verification and stable delivery, not another parser implementation.
Reviewed 30 October 2026 against
main9bc12ee041ca854c6f81de95fd8c6e49d7cc028c. This audit inspected code, PR metadata, tests and release ancestry; it did not run the customer's Docker workload.1. What has already been completed
c9a7e55e3e936c34492e297a140309d1a16fe5d6patchEnvVarsstrings.Cut(v, "="), retains the complete value, ignores entries without a separator or with an empty name, and applies explicit patches afterward.The root cause is the inherited environment preparation for the user probe. Splitting at every
=discarded all segments after the first value segment. The current implementation preserves everything after the first separator. The fix is in the Linux container agent path even when the launching client runs on macOS or Windows.Keep the existing behavior around environment precedence. In particular, the test deliberately separates config-level
containerEnv/remoteEnvprecedence from an explicit conflicting--workspace-envassignment. This issue does not change those contracts or the CLI's existing empty-assignment removal semantics.2. Exact remaining work
D1. Verify the published candidate, using the existing regression
e2e/bin/devsy-linux-amd64. Run the existing Ginkgo spec namedlifecycle hooks preserve equals signs in environment values. Invoke the test runner without a preceding build task that replaces this file with a development binary. The framework constructs the binary path inframework.go.DEVSY_AGENT_URL,DEVSY_AGENT_BINARYand transport overrides out of this release run. A passing new host CLI with an unverified old container agent is insufficient.e2e/tests/up/testdata/docker-workspace-env-equals, itsloginInteractiveShelluser probe, andwaitFor: postStartCommand. Do not replace the hook checks with an assertion only againstworkspace ssh; that was already working in the report./etc/envfile.json; the existing test selects only fixture keys inside the container.Expected exact values in both lifecycle hook files, SSH output and the selected persisted keys:
PLAINhelloONE_EQa=bTWO_EQa=b=cCOMMA_EQx=1,y=2TRAILING_EQz=FILE_ONE_EQk=vREMOTE_EQin the existing precedence fixtureremote=a=bThe restart assertion must delete only the fixture's previous post-start output, perform a normal stop/start, and observe a newly produced correct file. Do not recreate the workspace to make the restart assertion pass.
D2. Confirm the customer-facing upgrade path
D3. Only if a fixed artifact still fails
patchEnvVarsagain.3. Completion criteria
Implementation is complete. Keep this issue as the existing delivery tracker until the published CLI/Desktop candidate passes the customer-value checks and the fixed supported release is identified. No duplicate implementation ticket is needed. Close as fixed once the release and validation evidence are recorded; retain any unrelated follow-up under its own issue.
skevetter commentedon Oct 31, 2026
Completed