Skip to content

Abandon the server-side thread when a new chat starts - #4650

Open
nelsonkopliku wants to merge 3 commits into
ai-cancel-run-channelfrom
abandon-thread-on-new-chat
Open

Abandon the server-side thread when a new chat starts#4650
nelsonkopliku wants to merge 3 commits into
ai-cancel-run-channelfrom
abandon-thread-on-new-chat

Conversation

@nelsonkopliku

@nelsonkopliku nelsonkopliku commented Aug 19, 2026

Copy link
Copy Markdown
Member

Description

This PR introduces the ability to issue an abandon_thread message from the client so that the server can clean up the related running Agent.

The action is wired on "New Chat" button in chat header, that means that when a user starts a new chat, not only the client will be reset to a fresh state, but contextually the server will be told to stop any previous running Agent.

How was this tested?

Automated and IRL.

@nelsonkopliku nelsonkopliku added the enhancement New feature or request label Aug 19, 2026
@nelsonkopliku nelsonkopliku self-assigned this Aug 19, 2026
@nelsonkopliku nelsonkopliku added this to the 3.2.0 milestone Aug 19, 2026
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 0367c85 to 279c65a Compare August 19, 2026 12:18
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 279c65a to 9790d42 Compare August 20, 2026 12:44
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 9790d42 to dea0ab3 Compare August 20, 2026 14:03
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from dea0ab3 to 2906839 Compare August 20, 2026 14:11
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 2906839 to 34fa21d Compare August 24, 2026 08:06
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch 2 times, most recently from 713925c to 8271bc3 Compare August 24, 2026 14:29
@nelsonkopliku
nelsonkopliku requested review from gagandeepb and a balanced review from Copilot August 24, 2026 14:33
@nelsonkopliku
nelsonkopliku marked this pull request as ready for review August 24, 2026 14:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side thread abandonment when starting a new chat, allowing the server to stop the previous Agent.

Changes:

  • Adds abandonThread() transport support.
  • Filters stale run lifecycle events.
  • Wires abandonment into thread changes with expanded tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
assets/js/lib/ai/WebSocketAIAgent.js Adds abandonment and stale-event filtering.
assets/js/lib/ai/WebSocketAIAgent.test.js Tests abandonment and stale events.
assets/js/common/AIAssistant/AssistantChatProvider.jsx Abandons the previous thread on reset.
assets/js/common/AIAssistant/AssistantChatProvider.test.jsx Verifies provider behavior.
assets/js/common/AIAssistant/AIAssistant.test.jsx Verifies fresh conversations after reopening.
assets/js/common/AIAssistant/AgUiEventFlow.test.jsx Verifies old messages are cleared.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread assets/js/lib/ai/WebSocketAIAgent.js
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 8271bc3 to e678ec3 Compare August 24, 2026 15:07
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from e678ec3 to a1f1484 Compare August 25, 2026 06:51
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from a1f1484 to 400f0f0 Compare August 25, 2026 08:40
@nelsonkopliku
nelsonkopliku force-pushed the abandon-thread-on-new-chat branch from 400f0f0 to ad8913a Compare August 25, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants