Skip to content

bug: keep '=' in extra docker config environment values - #680

Merged
Martin-Molinero merged 1 commit into
QuantConnect:masterfrom
Amadeus-22:bug-679-extra-docker-env-equals
Oct 27, 2026
Merged

Martin-Molinero merged 1 commit into
QuantConnect:masterfrom
Amadeus-22:bug-679-extra-docker-env-equals

Conversation

@Amadeus-22

Copy link
Copy Markdown
Contributor

Closes #679.

  • --extra-docker-config '{"environment": ["JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8", "TOKEN=abc=="]}' passed {"JAVA_TOOL_OPTIONS": "-Dfile.encoding", "TOKEN": "abc"} to the container: LeanRunner.parse_extra_docker_config split KEY=VALUE strings on every = and kept the first two parts.
  • They are now split on the first = only, as Docker does. Entries given as [key, value] pairs and the dict form are unchanged.
  • Added a test with a JVM -D option and a base64-padded value. It fails on master and passes with the fix.
  • pytest tests/components/docker tests/commands/test_backtest.py tests/commands/test_research.py passes (119 passed, 6 skipped, Python 3.12) and python static_analysis.py is clean.

🤖 Generated with Claude Code

Split KEY=VALUE environment entries on the first '=' only, so values
like -Dfile.encoding=UTF-8 or base64 tokens are not truncated.

Closes QuantConnect#679

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Martin-Molinero Martin-Molinero added the kronos:review Request review label Oct 27, 2026
@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added kronos:review:queued review: queued kronos:review:working review: in progress and removed kronos:review Request review kronos:review:queued review: queued labels Oct 27, 2026

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. The fix is correct, small and covered by a test.

  • item.split("=", 1) matches how Docker handles -e KEY=VALUE: it splits on the first = only. I checked that docker run -e TOKEN=abc== -e J=-Da=b gives TOKEN=abc== and J=-Da=b inside the container. The Docker SDK turns the resulting dict back into KEY=VALUE with the value unchanged (docker.utils.format_environment), so the value reaches the container intact.
  • The change only affects KEY=VALUE strings in the list form. [key, value] pairs, the dict form and KEY= (empty value) behave as before. A bare KEY with no = still raises IndexError, just as it did on master. Docker would pass the host's value through in that case, but that is outside this issue and can go in its own PR if anyone wants it.
  • The single helper is shared by backtest, live, optimize, research and private-cloud start, so all of them get the fix.
  • The new test checks the exact output for a JVM -D option and a base64-padded value. CI passes on every OS and Python version.

No other repositories need updating.

@quantconnect-kronos-reviewer quantconnect-kronos-reviewer Bot added risk:low Low risk and removed kronos:review:working review: in progress labels Oct 27, 2026
@Martin-Molinero
Martin-Molinero merged commit 5f94e71 into QuantConnect:master Oct 27, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Low risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Environment values containing '=' are truncated in --extra-docker-config

2 participants