fix(delegate): guard _load_config() against delegation: null in config.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 fd9b692d (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 #7215, #7346)
This commit is contained in:
ideathinklab01-source 2026-04-27 11:48:01 +08:00 committed by Teknium
parent 2d3d1d9736
commit d17eff29d5

View file

@ -2337,7 +2337,7 @@ def _load_config() -> dict:
try:
from cli import CLI_CONFIG
cfg = CLI_CONFIG.get("delegation", {})
cfg = CLI_CONFIG.get("delegation") or {}
if cfg:
return cfg
except Exception:
@ -2346,7 +2346,7 @@ def _load_config() -> dict:
from hermes_cli.config import load_config
full = load_config()
return full.get("delegation", {})
return full.get("delegation") or {}
except Exception:
return {}