Skip to content

Fix duplicated message issue with switching tabs while streaming#1814

Merged
TamiTakamiya merged 2 commits intomainfrom
TamiTakamiya/AAP-62685/duplicated_messages_with_switching_tab
Jan 19, 2026
Merged

Fix duplicated message issue with switching tabs while streaming#1814
TamiTakamiya merged 2 commits intomainfrom
TamiTakamiya/AAP-62685/duplicated_messages_with_switching_tab

Conversation

@TamiTakamiya
Copy link
Contributor

@TamiTakamiya TamiTakamiya commented Jan 15, 2026

Jira Issue: https://issues.redhat.com/browse/AAP-62685

Note: Test case was generated by Claude Code.

Description

Fix the issue that generates duplicated messages if user switches browser tabs while chatbot response has not fully received in the streaming mode. See the Jira ticket for more details.

Testing

Steps to test

  1. Pull down the PR
  2. Run unit tests

For manual test using source codes extracted from this PR, see the instructions documented here.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to break)
  • Security fix
  • Performance improvement
  • Code refactoring
  • Documentation update
  • CI/CD update

Backport Policy

This change should be:

  • Not backported - main/master only
  • Backported to specific releases (add labels after merge)

Automated Backport Instructions

After this PR is merged, add one or more labels to automatically create backport PRs:

  • backport/stable-2.6 - Backport to stable-2.6 branch

Backport Justification

It's a high severity bug and the fix should be very safe.

Special backport considerations:

We need to have a new npm package and update aap-ui repository to pick up the updated npm package.

Scenarios tested

Unit tests and manual tests.

Production deployment

  • This code change is ready for production on its own
  • This code change requires the following considerations before going to production:

Note

Prevents duplicate chatbot responses during streaming when the browser tab becomes hidden.

  • Add openWhenHidden: true to streaming fetchEventSource options in useChatbot.ts (both aap_chatbot and ansible_ai_connect_chatbot)
  • Bump package version to 0.1.8

Written by Cursor Bugbot for commit efb646e. This will update automatically on new commits. Configure here.

Copy link
Contributor

@romartin romartin left a comment

Choose a reason for hiding this comment

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

That's great, thanks @TamiTakamiya ! <3

BTW Is it possible to write some test that ensures the openWhenHidden parameter being set?

@TamiTakamiya
Copy link
Contributor Author

That's great, thanks @TamiTakamiya ! <3

BTW Is it possible to write some test that ensures the openWhenHidden parameter being set?

Thank you for your comment. I added a test case, which was generated by Claude Code. Could you take a look again?

@sonarqubecloud
Copy link

Copy link
Contributor

@ldjebran ldjebran left a comment

Choose a reason for hiding this comment

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

LGTM

@TamiTakamiya TamiTakamiya merged commit 1aa61ab into main Jan 19, 2026
13 checks passed
@TamiTakamiya TamiTakamiya deleted the TamiTakamiya/AAP-62685/duplicated_messages_with_switching_tab branch January 19, 2026 15:10
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.

3 participants

Comments