-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Summary
LM::execute_tool_loop currently executes the initial tool call, then iterates with for iteration in 1..max_iterations.
When max_tool_iterations is set to 1, that follow-up loop runs zero times and the function always returns Max tool iterations reached, even though one iteration was explicitly allowed.
Why this matters
This makes max_tool_iterations=1 unusable for valid single-iteration tool workflows and can surface as an unexpected hard failure.
Reproduction
- Configure an
LMwithmax_tool_iterations = 1. - Make a request that triggers a tool call.
- Observe that the initial tool is executed, then the call fails with
Max tool iterations reached.
Expected
With max_tool_iterations=1, one follow-up completion turn should be attempted after the initial tool result is appended, or the setting semantics should be clarified and enforced consistently.
Actual
No follow-up completion turn is attempted; the function exits with a max-iterations error.
Candidate fixes
- Adjust loop bounds (for example
1..=max_iterations) if the current setting represents allowed completion iterations after the initial tool call. - Or redefine semantics so
max_tool_iterationsis total tool-call budget and update logic/docs accordingly.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels