Skip to content

fix(agent): make stop end the running turn - #68

Merged
Rl0007 merged 2 commits into
mainfrom
fix/agent-stop
Oct 6, 2026
Merged

Rl0007 merged 2 commits into
mainfrom
fix/agent-stop

Conversation

@Rl0007

@Rl0007 Rl0007 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
  1. Clicking Stop in the assistant did not stop the turn: it kept calling tools until it hit the step limit, and a prompt sent meanwhile was rejected with "This session is already running" and lost.
  2. Stop now ends the turn at the next step, and the composer stays busy until the server confirms the stop, so the next prompt goes through.

You can visit the assistant panel in /wikify to see it.

Fixes #24

Verification
  • New test_cancel_from_another_process_stops_the_tool_loop (LLM stubbed to always return a tool call, Stop set the way a separate web request leaves it): on main the turn ran all 25 LLM rounds; with the fix it stops after 1. test_agent: 29/29 pass.
  • Full suite on a devbox: 486 tests, 475 pass, 0 fail, 11 skipped (baseline 485, plus the new test).
  • Devbox, LLM stubbed (the box has no model): the runner ran in its own process, and Stop went through the real wikify.api.agent.cancel endpoint. On main the turn kept going to all 25 rounds, ended with "took too many steps", and a prompt sent right after Stop was rejected. With the fix the turn stopped about 1 s after Stop, and the next prompt was accepted.
  • Frontend: one line removed in useAgentChat.js. No visible change after the turn ends; the Stop button stays up only until the server's complete event arrives.
  • Reviewer: APPROVE.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 merged commit 74f79df into main Oct 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop doesn't stop the assistant, and blocks the next prompt

1 participant