The GitHub Actions job "Benchmarks PR Comment" on texera.git/main has succeeded.
Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).

Head commit for run:
a1b5aad0e39ed184ea715cd108ea249fabe864f7 / Jiadong Bai 
<[email protected]>
feat(agent-service): tell users when the step limit is hit (#9593)

### 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.

> I stopped because I reached the limit of 25 steps for one message, so
the task may be unfinished. Send another message to continue, or raise
the limit in the agent's settings.

- **Where:** `sendMessage` in `agent-service/src/agent/texera-agent.ts`
adds it as a closing agent step, as for a stopped or failed turn. The
frontend is unchanged.
- **When:** only if the loop's stop condition ended the turn. The AI SDK
asks it only when the loop would otherwise go on, so a turn that ends
for another reason on its last allowed step gets no message.
- **Next turn:** the model reads it as the last entry of the earlier
task.
- **Stop on the last step:** a stop that lands on the last allowed step
now ends with "Generation stopped by user.", as one on an earlier step
does. Before, that turn ended with no message.

**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":

<img width="1228" height="704" alt="Before: the agent adds three
operators, then the chat ends on Execute 1 tool with no message"
src="https://github.com/user-attachments/assets/30b0ff28-9f79-4e50-8cae-aef48c9afa23";
/>

After, the agent says it stopped at the limit, and "continue" finishes
the workflow:

<img width="1228" height="704" alt="After: the agent says it stopped at
the limit of 3 steps, and continue adds the bar chart and finishes"
src="https://github.com/user-attachments/assets/f5f4e11a-6f97-43f3-9c0a-c111c4ddee07";
/>

### Any related issues, documentation, discussions?

Closes #9592
Part of #9576

### How was this PR tested?

- `bun test` in `agent-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.
- Live with Claude Haiku 5.5 and a limit of 2: the chat panel showed the
message, and "continue" resumed the work.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Fable 5.2)

Report URL: https://github.com/apache/texera/actions/runs/45445388661

With regards,
GitHub Actions via GitBox

Reply via email to