config: a flat --cfg-options key for an env setting (workers=4) is ignored with a structured config
With a structured config, a flat --cfg-options key for an env setting is accepted and then ignored. The YAML value wins, with no warning.
apply_overrides stores a flat key that is not in _FLATTEN_MAP (for example workers, max_turns, limit) at the top level of the config. flatten_config copies top-level keys first and then copies the env section's keys over them, so env.workers from the YAML replaces the override. The docstring says flat key=value is supported "for flat configs or flat keys in env section".
Code:
- https://github.com/microsoft/SkillOpt/blob/45f65ca04f5f6713bca7b9797b495696ba812751/skillopt/config.py#L394-L401
- https://github.com/microsoft/SkillOpt/blob/45f65ca04f5f6713bca7b9797b495696ba812751/skillopt/config.py#L330-L340
Steps to reproduce
from skillopt.config import flatten_config, load_config
cfg = load_config("configs/searchqa/default.yaml", overrides=["workers=4", "max_turns=3"])
flat = flatten_config(cfg)
print(flat["workers"], flat["max_turns"])
cfg = load_config("configs/searchqa/default.yaml", overrides=["env.workers=4"])
print(flatten_config(cfg)["workers"])
The same happens through skillopt-train --config configs/searchqa/default.yaml --cfg-options workers=4.
Expected
4 3
4
Actual
24 1
4
Only the dotted form env.workers=4 takes effect. The legacy --workers 4 flag works too, because scripts/train.py maps it to env.workers.
Environment
main at 45f65ca, Python 3.10, Windows 11.
I have a fix with a regression test and will open a PR.