Skip to content

fix: preserve default Docker extra_volumes in factor/model envs (#1428)#1435

Open
utsab345 wants to merge 1 commit into
microsoft:mainfrom
utsab345:fix/extra-volumes-overwrite-bug
Open

fix: preserve default Docker extra_volumes in factor/model envs (#1428)#1435
utsab345 wants to merge 1 commit into
microsoft:mainfrom
utsab345:fix/extra-volumes-overwrite-bug

Conversation

@utsab345

@utsab345 utsab345 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1428 by preserving the default Docker extra_volumes configuration when no explicit volume mappings are provided.

What changed

  • Updated get_factor_env() to avoid overwriting env.conf.extra_volumes when extra_volumes is empty.
  • Applied the same fix to get_model_env() to keep the behavior consistent across both environment factories.
  • Retained the existing QlibDockerConf default volume mappings unless the caller explicitly provides custom mappings.

Why

Both get_factor_env() and get_model_env() initialized extra_volumes with an empty dictionary and unconditionally assigned it to env.conf.extra_volumes.

As a result, the default QlibDockerConf mount:

  • ~/.qlib//root/.qlib/

was replaced with an empty dictionary. Consequently, QTDockerEnv.prepare() attempted to access the first configured volume and raised a StopIteration, preventing Docker-based factor/model workflows from starting.

With this change, the default configuration is preserved unless the caller explicitly supplies custom volume mappings.

Testing

  • Confirmed the reported bug and reproduced the failure.
  • Verified that the previous implementation raises StopIteration while the updated implementation preserves the default configuration.
  • python -m py_compile passed for all modified files.
  • Import test passed (299 subtests), confirming the modified modules load successfully.

Files Changed

  • rdagent/components/coder/factor_coder/config.py
  • rdagent/components/coder/model_coder/config.py

Branch

fix/extra-volumes-overwrite-bug

Commit

477b6bc

Closes #1428.


📚 Documentation preview 📚: https://RDAgent--1435.org.readthedocs.build/en/1435/

…ctor_env/get_model_env

Both get_factor_env() and get_model_env() used extra_volumes: dict = {}
as default and unconditionally assigned env.conf.extra_volumes =
extra_volumes.copy(), which wiped out the correct defaults set by
QlibDockerConf (e.g., mounting ~/.qlib/ to /root/.qlib/). This caused
StopIteration in QTDockerEnv.prepare() when calling
next(iter(self.conf.extra_volumes.keys())) on the empty dict.

Changed default to None and only overwrite when a non-None value is
explicitly passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: get_factor_env() overwrites extra_volumes with empty dict, causing StopIteration in QTDockerEnv.prepare()

1 participant