Files
kandev/apps/web
João Salavisa 58fb9ffb0f fix: dedupe cancel-turn clicks to stop "turn cancelled" cascade (#784)
* fix: dedupe cancel-turn clicks to stop "turn cancelled" cascade

The cancel button had no in-flight feedback, so impatient users clicked
it repeatedly while the agent was tearing down a slow turn (e.g. a
Claude Monitor tool). Each click reached the backend and emitted its
own "Turn cancelled by user" message, with the second-and-later calls
also lazily creating phantom turns to host those messages.

Fix on both sides: SubmitButton now tracks isCancelling locally and
disables itself with a spinner while the request is in flight; the
orchestrator deduplicates concurrent CancelAgent calls per session via
a sync.Map guard so duplicates that slip through return immediately.

* fix: address PR review feedback

- Test: replace sleep-based polling in cancel-dedupe test with channel
  synchronization (cancelAgentEntered) per project convention.
- UI: switch the cancel re-entrancy guard from state to a ref so
  isCancelling no longer thrashes the useCallback dep array.

---------

Co-authored-by: Kandev Agent <agent@kandev.dev>
2026-05-02 22:49:19 +01:00
..
2026-05-02 22:25:40 +01:00
2026-05-02 22:25:40 +01:00
2026-02-26 23:08:15 +00:00
2026-05-02 22:25:40 +01:00
2026-01-10 11:27:28 +00:00
2026-03-02 08:54:58 +00:00