Repository navigation
feat(agent-service): tell users when the step limit is hit - #9593
Conversation
A turn that reaches the step limit ended on a tool call and the chat went quiet. The agent now closes such a turn with a step that says it stopped at the limit and that the user can send another message to continue or raise the limit.
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9593 +/- ##
============================================
- Coverage 91.57% 91.57% -0.01%
Complexity 5182 5182
============================================
Files 1300 1300
Lines 58131 58128 -3
Branches 7615 7615
============================================
- Hits 53235 53232 -3
Misses 2958 2958
Partials 1938 1938
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kunwp1
left a comment
There was a problem hiding this comment.
LGTM! Left some comments.
The step-limit notice, the stopped step and the error step differed only in their text. sendMessage now builds all three through one addClosingStep helper.
A stop that landed on the last allowed step let generateText return normally, so the turn ended with no message and sendMessage reported stopped: false. It now ends with "Generation stopped by user.", as a stop on an earlier step does.
| const limit = maxSteps === 1 ? "1 step" : `${maxSteps} steps`; | ||
| return ( | ||
| `I stopped because I reached the limit of ${limit} for one message, so the task may be unfinished. ` + | ||
| "Send another message to continue, or raise the limit in the agent's settings." |
There was a problem hiding this comment.
Small follow-up now that this is in: the notice says "raise the limit", but the dialog and now the API stop at 50 and for a looping agent "send another message" just gives it another full budget. Do you think we can say something like "rephrase or break the task down" instead?
What changes were proposed in this PR?
A turn that reaches the step limit now ends with a message from the agent. Before, the chat went quiet.
sendMessageinagent-service/src/agent/texera-agent.tsadds it as a closing agent step, as for a stopped or failed turn. The frontend is unchanged.A request that needs four operators, with the step limit set to 3 and a scripted model. Before, the agent stops after three and the chat ends on "Execute 1 tool":
After, the agent says it stopped at the limit, and "continue" finishes the workflow:
Any related issues, documentation, discussions?
Closes #9592
Part of #9576
How was this PR tested?
bun testinagent-service, eight new tests. The message appears at the limit and names the limit the turn started with. It does not appear when the model answers on its last allowed step, a cut-off tool call ends the turn, or the user stops it. A stop on the last allowed step ends as stopped.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5.2)