fix(delegate): guard _load_config() against delegation: null in config.yaml#16345
Closed
ideathinklab01-source wants to merge 1 commit into
Closed
fix(delegate): guard _load_config() against delegation: null in config.yaml#16345ideathinklab01-source wants to merge 1 commit into
ideathinklab01-source wants to merge 1 commit into
Conversation
…g.yaml
YAML parses `delegation: null` as Python None. `dict.get(key, {})`
only uses the default when the key is *missing*, not when it exists with
a None value, so `cfg.get("max_concurrent_children")` crashes with
`'NoneType' object has no attribute 'get'`.
Same pattern as fd9b692 (fix(tui): tolerate null top-level sections).
Use `dict.get(key) or {}` to handle both missing and None-valued keys.
Closes: delegation null config crash (same class as NousResearch#7215, NousResearch#7346)
Contributor
|
Salvaged via #19662 onto current main - your commit authorship was preserved. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
delegation: nullinconfig.yamlcausesNoneType object has no attribute 'get'on every API call that triggers the delegation path:Root Cause
_load_config()usesdict.get("delegation", {})which returns the default{}only when the key is missing. Whendelegation: nullis present in YAML, the key exists with valueNone, so.get()returnsNone— and downstreamcfg.get(...)crashes.This is the same class of bug as the one fixed in fd9b692 (
fix(tui): tolerate null top-level sections in config.yaml), which guarded 21 sites intui_gateway/server.pybut misseddelegate_tool.py.Related issues: #7215, #7346
Fix
Use
dict.get(key) or {}instead ofdict.get(key, {})in_load_config(), consistent with the pattern from fd9b692:Testing
delegation: nullno longer crashes;_get_max_concurrent_children()correctly falls back to the default (3)delegation: {}anddelegation: {max_concurrent_children: 5}still work as expected