Skip to content

fix(config): let a flat --cfg-options key override an env setting - #411

Open
Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
microsoft:mainfrom
1AbdullahButt:fix/cfg-options-flat-env-key
Open

Muhammad Abdullah Butt (1AbdullahButt) wants to merge 1 commit into
microsoft:mainfrom
1AbdullahButt:fix/cfg-options-flat-env-key

Conversation

@1AbdullahButt

Copy link
Copy Markdown
Contributor

Fixes #409

With a structured config, apply_overrides stored a flat key that is not in _FLATTEN_MAP (for example workers=4) at the top level. flatten_config copies top-level keys first and the env section's keys after them, so the YAML's env.workers silently replaced the command-line value.

When the config's env section already has the key, the override is now written there, the same place env.workers=4 and the legacy --workers 4 flag put it. Other flat keys are still stored at the top level as before.

Tests

  • New tests/test_cfg_options_flat_env_key.py: a flat override of an existing env key wins, the flat and dotted forms give the same flattened config, and a new flat key still reaches the trainer. The first two fail on main and pass here.
  • Ran every test file that imports skillopt.config or load_config on Windows, Python 3.10. The only failures are 12 in tests/test_sleep_config_encoding.py, and they fail the same way on main.

Claude Code wrote this change.

🤖 Generated with Claude Code

With a structured config, apply_overrides stored an unmapped flat key
such as workers=4 at the top level. flatten_config copies top-level keys
first and the env section's keys after them, so the YAML's env.workers
silently replaced the command-line value.

When the env section already has the key, write the override there.

Fixes microsoft#409

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

config: a flat --cfg-options key for an env setting (workers=4) is ignored with a structured config

1 participant