fix(cli): fix max_turns comment and test for correct priority order

Priority is: CLI arg > config file > env var > default
(not env var > config file as the old comment stated)

The test failed because config.yaml had max_turns at both root level
and inside agent section. The test cleared agent.max_turns but the
root-level value still took precedence over the env var. Fixed the
test to clear both, and corrected the comment to match the intended
priority order.
This commit is contained in:
teknium1
2026-03-02 01:15:10 -08:00
parent 866fd9476b
commit afb680b50d
2 changed files with 8 additions and 4 deletions

2
cli.py
View File

@@ -850,7 +850,7 @@ class HermesCLI:
self.api_key = api_key or os.getenv("OPENAI_API_KEY") or os.getenv("OPENROUTER_API_KEY")
self._nous_key_expires_at: Optional[str] = None
self._nous_key_source: Optional[str] = None
# Max turns priority: CLI arg > env var > config file (agent.max_turns or root max_turns) > default
# Max turns priority: CLI arg > config file > env var > default
if max_turns is not None: # CLI arg was explicitly set
self.max_turns = max_turns
elif CLI_CONFIG["agent"].get("max_turns"):