What's Fixed
Duplicate message after stopping agent 🔁
Bug: Stop agent → send new message → the message appears twice: once active (executing) and once as a queued duplicate.
Root cause: Race condition between client and server state:
- Client immediately sets
tab.generating = falseon Stop (optimistic UI) - Server's
ws._tabBusystayedtrueuntil the subprocess fully exited - New message arrived during this window → server queued it → client created a duplicate DOM element
Fix: Two-part:
stophandler now immediately setsws._tabBusy = falseprocessChatfinally block detects "stale" cleanup via abort controller reference comparison — prevents the old, aborted processChat from resetting the busy flag that a new processChat has already claimed
Queue deletion actually works now 🗑️
Bug: Deleting a queued message only greyed it out (opacity: 0.4). Switching tabs or refreshing brought it back — because the server had no handler for queue_remove.
Fix: Added queue_remove and queue_edit WebSocket handlers on the server. Items are now actually spliced from the queue array.
Files Changed
server.js— stop race condition fix, queue_remove/queue_edit handlers