NousResearch / NousResearch/hermes-agent
ACP ignores agent.max_turns and falls back to 90 iterations
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 247k
- Forks
- 52k
- PR merge metrics
- PR metrics pending
Description
Bug description
ACP sessions ignore the configured agent.max_turns value. SessionManager._make_agent() loads config.yaml, but constructs AIAgent(**kwargs) without passing max_iterations. ACP therefore falls back to agent/agent_init.py's constructor default of 90 iterations.
This causes tool-heavy ACP turns to stop at exactly 90 iterations even when hermes config get agent.max_turns reports a higher value.
Reproduction
Environment:
- Hermes Agent v0.20.4 (2026.8.18)
- Native Windows 11
- VS Code ACP Client
agent.max_turns: 150
Steps:
-
Configure
agent.max_turnsabove 90:hermes config set agent.max_turns 150 hermes config get agent.max_turns # 150 -
Start a fresh ACP session and run a tool-heavy coding task.
-
Observe the turn stops after exactly 90 assistant messages with
finish_reason=tool_calls. -
Hermes injects:
You've reached the maximum number of tool-calling iterations allowed. Please provide a final response summarizing what you've found and accomplished so far, without calling any more tools.
Expected behavior
ACP should pass the resolved agent.max_turns value to AIAgent(max_iterations=...), matching CLI behavior.
Actual behavior
acp_adapter/session.py::_make_agent() builds kwargs for AIAgent but omits max_iterations; the configured value is never used.
Current upstream main was checked at 41447a6 and still has the omission.
Proposed fix
Read config["agent"]["max_turns"] from the already-loaded config and include it as max_iterations when constructing the ACP AIAgent:
agent_config = config.get("agent") or {}
configured_max_turns = (
agent_config.get("max_turns")
if isinstance(agent_config, dict)
else None
)
# ... build kwargs ...
if configured_max_turns is not None:
kwargs["max_iterations"] = configured_max_turns
Add a regression test that monkeypatches load_config() with {"agent": {"max_turns": 150}}, captures the AIAgent constructor kwargs, and asserts max_iterations == 150.
Local verification
The proposed patch was applied locally using TDD:
- Regression test before fix: failed with
KeyError: 'max_iterations' - Regression test after fix: passed
- ACP tests excluding four pre-existing Windows-only POSIX pipe/symlink cases: 127 passed, 4 deselected
git diff --check: passedpy_compile: passed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in acp_adapter/session.py at SessionManager._make_agent(), then inspect how the already-loaded config is used to build AIAgent kwargs. Add the regression test described in the issue, capturing constructor kwargs with agent.max_turns set to 150 and checking max_iterations. Run the ACP tests and confirm the regression passes without introducing new failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100