You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: MAX_STEPS does not actually disable tools when step limit reached #24505
In packages/opencode/src/session/prompt.ts, when isLastStep is true (i.e., the agent has reached the MAX_STEPS limit), a prefilled assistant message claims that tools are disabled. However, the full tools object is still passed to handle.process(), which allows the model to continue making tool calls even though it should be forced to return a final answer.\n\nThe fix is to pass an empty object/array for tools when isLastStep is true, so the model cannot invoke any further tools.
No issue template was used. Please use one of the three required templates: Bug Report, Feature Request, or Question. Since this describes incorrect behavior, a Bug Report template would be most appropriate and should include reproduction steps/context.
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue may be related to an existing issue. Please check:
[FEATURE]: agent definitions should have optional maxSteps #3631: The original feature request for maxSteps explicitly noted that "on the n-1 step, it should remove all tools from the request to force a text response" — this issue reports that behavior was not fully implemented.
If you believe this was flagged incorrectly, please let a maintainer know.
Activity
github-actions commentedon Apr 26, 2026
This issue doesn't fully meet our contributing guidelines.
What needs to be fixed:
Please edit this issue to address the above within 2 hours, or it will be automatically closed.
This issue may be related to an existing issue. Please check:
maxSteps#3631: The original feature request formaxStepsexplicitly noted that "on the n-1 step, it should remove all tools from the request to force a text response" — this issue reports that behavior was not fully implemented.If you believe this was flagged incorrectly, please let a maintainer know.
github-actions commentedon Apr 26, 2026
This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.
Feel free to open a new issue that follows our issue templates.