Skip to content

Disable New Chat during a run - #4581

Merged
nelsonkopliku merged 1 commit into
mainfrom
disable-new-chat-while-streaming
Aug 6, 2026
Merged

Disable New Chat during a run#4581
nelsonkopliku merged 1 commit into
mainfrom
disable-new-chat-while-streaming

Conversation

@nelsonkopliku

@nelsonkopliku nelsonkopliku commented Aug 5, 2026

Copy link
Copy Markdown
Member

Description

This PR makes sure that during a run the "New Chat" button is disabled in chat header.

This prevents seeing a "Thinking" spinner on a new chat until the previous run actually finishes.

I am opening this because the more complete cancellation feature at #4563 requires some more love and it is currently lower prio.

Current solution prevents weird situations at least.

How was this tested?

Automated and IRL

@nelsonkopliku
nelsonkopliku force-pushed the disable-new-chat-while-streaming branch from 54cc464 to 1b2c18c Compare August 5, 2026 15:29
@nelsonkopliku
nelsonkopliku requested review from antgamdia, arbulu89 and gagandeepb and a lite review from Copilot August 5, 2026 15:29
@nelsonkopliku nelsonkopliku self-assigned this Aug 5, 2026
@nelsonkopliku nelsonkopliku added the enhancement New feature or request label Aug 5, 2026
@nelsonkopliku nelsonkopliku added this to the 3.2.0 milestone Aug 5, 2026

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

This PR prevents starting a new conversation while an assistant run is still in flight by disabling the “New chat” button during active runs. It aligns the header behavior with the existing “run in progress” UX (e.g., spinner/progress and composer locking), avoiding the confusing “Thinking…” state on an empty/new thread while the prior run is still settling.

Changes:

  • Add an isRunning prop to ChatHeader and disable “New chat” when isRunning is true.
  • Plumb isRunning from AssistantThread into ChatHeader.
  • Add/extend unit and integration coverage (ChatHeader, AssistantThread, AG-UI event flow) plus Storybook controls/examples.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
assets/js/common/AIAssistant/ChatHeader/ChatHeader.jsx Disable “New chat” when a run is active via new isRunning prop.
assets/js/common/AIAssistant/AssistantThread.jsx Pass isRunning through to the header.
assets/js/common/AIAssistant/ChatHeader/ChatHeader.test.jsx Add unit test ensuring “New chat” is disabled during a run.
assets/js/common/AIAssistant/AssistantThread.test.jsx Add test that “New chat” is locked while answering.
assets/js/common/AIAssistant/AgUiEventFlow.test.jsx Add integration test verifying “New chat” stays locked for the run duration.
assets/js/common/AIAssistant/ChatHeader/ChatHeader.stories.jsx Add Storybook control and a “Running” story for the new state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@antgamdia antgamdia 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.

Thanks! This will prevent impatient users from clicking it and losing the chat context 😅

@nelsonkopliku
nelsonkopliku merged commit 83d3100 into main Aug 6, 2026
58 checks passed
@nelsonkopliku
nelsonkopliku deleted the disable-new-chat-while-streaming branch August 6, 2026 05:37
nelsonkopliku added a commit that referenced this pull request Aug 7, 2026
Stop in the composer becomes the only way to end a run; "New chat" is
reachable only when the thread is idle. This restores #4581, which this
branch had reverted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nelsonkopliku added a commit that referenced this pull request Aug 7, 2026
Stop in the composer becomes the only way to end a run; "New chat" is
reachable only when the thread is idle. This restores #4581, which this
branch had reverted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nelsonkopliku added a commit that referenced this pull request Aug 10, 2026
Stop in the composer becomes the only way to end a run; "New chat" is
reachable only when the thread is idle. This restores #4581, which this
branch had reverted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

3 participants