fix(cli): respect explicit --max-turns value even when it equals default
max_turns used 60 as both the default and the sentinel to detect whether the user passed the flag. This meant `--max-turns 60` was indistinguishable from "not passed", so the env var HERMES_MAX_ITERATIONS would silently override the explicit CLI value. Change the default to None so any user-supplied value takes priority.
This commit is contained in:
parent
bf9dd83c10
commit
2c28d9f560
1 changed files with 4 additions and 4 deletions
6
cli.py
6
cli.py
|
|
@ -742,7 +742,7 @@ class HermesCLI:
|
||||||
provider: str = None,
|
provider: str = None,
|
||||||
api_key: str = None,
|
api_key: str = None,
|
||||||
base_url: str = None,
|
base_url: str = None,
|
||||||
max_turns: int = 60,
|
max_turns: int = None,
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
compact: bool = False,
|
compact: bool = False,
|
||||||
resume: str = None,
|
resume: str = None,
|
||||||
|
|
@ -792,7 +792,7 @@ class HermesCLI:
|
||||||
self._nous_key_expires_at: Optional[str] = None
|
self._nous_key_expires_at: Optional[str] = None
|
||||||
self._nous_key_source: 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 > env var > config file (agent.max_turns or root max_turns) > default
|
||||||
if max_turns != 60: # CLI arg was explicitly set
|
if max_turns is not None:
|
||||||
self.max_turns = max_turns
|
self.max_turns = max_turns
|
||||||
elif os.getenv("HERMES_MAX_ITERATIONS"):
|
elif os.getenv("HERMES_MAX_ITERATIONS"):
|
||||||
self.max_turns = int(os.getenv("HERMES_MAX_ITERATIONS"))
|
self.max_turns = int(os.getenv("HERMES_MAX_ITERATIONS"))
|
||||||
|
|
@ -2642,7 +2642,7 @@ def main(
|
||||||
provider: str = None,
|
provider: str = None,
|
||||||
api_key: str = None,
|
api_key: str = None,
|
||||||
base_url: str = None,
|
base_url: str = None,
|
||||||
max_turns: int = 60,
|
max_turns: int = None,
|
||||||
verbose: bool = False,
|
verbose: bool = False,
|
||||||
compact: bool = False,
|
compact: bool = False,
|
||||||
list_tools: bool = False,
|
list_tools: bool = False,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue