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:
8
cli.py
8
cli.py
@@ -742,14 +742,14 @@ class HermesCLI:
|
||||
provider: str = None,
|
||||
api_key: str = None,
|
||||
base_url: str = None,
|
||||
max_turns: int = 60,
|
||||
max_turns: int = None,
|
||||
verbose: bool = False,
|
||||
compact: bool = False,
|
||||
resume: str = None,
|
||||
):
|
||||
"""
|
||||
Initialize the Hermes CLI.
|
||||
|
||||
|
||||
Args:
|
||||
model: Model to use (default: from env or claude-sonnet)
|
||||
toolsets: List of toolsets to enable (default: all)
|
||||
@@ -792,7 +792,7 @@ class HermesCLI:
|
||||
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
|
||||
if max_turns != 60: # CLI arg was explicitly set
|
||||
if max_turns is not None:
|
||||
self.max_turns = max_turns
|
||||
elif os.getenv("HERMES_MAX_ITERATIONS"):
|
||||
self.max_turns = int(os.getenv("HERMES_MAX_ITERATIONS"))
|
||||
@@ -2642,7 +2642,7 @@ def main(
|
||||
provider: str = None,
|
||||
api_key: str = None,
|
||||
base_url: str = None,
|
||||
max_turns: int = 60,
|
||||
max_turns: int = None,
|
||||
verbose: bool = False,
|
||||
compact: bool = False,
|
||||
list_tools: bool = False,
|
||||
|
||||
Reference in New Issue
Block a user