Skip to content

fix(lightspeed): disable model selector during active chat sessions#3690

Open
its-mitesh-kumar wants to merge 3 commits into
redhat-developer:mainfrom
its-mitesh-kumar:fix/lightspeed-RHDHBUGS-3313-disable-model-selector-active-session
Open

fix(lightspeed): disable model selector during active chat sessions#3690
its-mitesh-kumar wants to merge 3 commits into
redhat-developer:mainfrom
its-mitesh-kumar:fix/lightspeed-RHDHBUGS-3313-disable-model-selector-active-session

Conversation

@its-mitesh-kumar

@its-mitesh-kumar its-mitesh-kumar commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary

Fixes RHDHBUGS-3313

Bug: Switching the model in an active conversation incorrectly opens a new chat instead of staying in the current session.

Root cause: The model selector's onSelect handler in LightSpeedChat.tsx unconditionally called onNewChat(), creating a new conversation every time the model was changed — even mid-conversation.

Fix:

  • Disable the model selector once a chat session has messages (messages.length > 0)
  • Show a localized tooltip explaining why: "Each chat session supports only one model. To switch models, open a new chat."
  • Remove the spurious onNewChat() call from the model selector's onSelect handler
  • Apply the same logic to both the footer and header model selectors for consistency

Changes

File What changed
LightSpeedChat.tsx Disable model selector when messages.length > 0; remove onNewChat() from onSelect; pass disabledTooltip prop
MessageBarModelSelector.tsx Accept disabledTooltip prop; wrap dropdown in <Tooltip> when disabled
ref.ts Add modelSelector.disabledTooltip translation key
de.ts, es.ts, fr.ts, it.ts, ja.ts Add translated tooltip strings
report-alpha.api.md Auto-generated API report update

UI before changes

Before fix

The model selector is clickable mid-conversation and switching models creates a new chat

UI after changes

After fix

The model selector is disabled once a message is sent, showing a tooltip on hover

Test plan

  • Reproduction test confirms model selector becomes disabled after sending a message
  • yarn tsc:full passes with no errors
  • yarn build passes
  • Lint-staged hooks pass on commit
  • Manual verification: open Lightspeed, send a message, confirm model selector is disabled with tooltip
  • Manual verification: start a new chat, confirm model selector is enabled again

Fixes: https://redhat.atlassian.net/browse/RHDHBUGS-3313
Signed-off-by: its-mitesh-kumar <itsmiteshkumar98@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@rhdh-gh-app

rhdh-gh-app Bot commented Jul 6, 2026

Copy link
Copy Markdown

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-lightspeed workspaces/lightspeed/plugins/lightspeed patch v2.9.1

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.29%. Comparing base (12b0c0b) to head (409ac7b).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3690   +/-   ##
=======================================
  Coverage   54.28%   54.29%           
=======================================
  Files        2347     2347           
  Lines       89650    89644    -6     
  Branches    25062    25068    +6     
=======================================
+ Hits        48666    48670    +4     
+ Misses      40724    40714   -10     
  Partials      260      260           
Flag Coverage Δ *Carryforward flag
adoption-insights 83.70% <ø> (ø) Carriedforward from 1bd1997
ai-integrations 68.35% <ø> (ø) Carriedforward from 1bd1997
app-defaults 69.79% <ø> (ø) Carriedforward from 1bd1997
augment 46.39% <ø> (ø) Carriedforward from 1bd1997
boost 74.68% <ø> (ø) Carriedforward from 1bd1997
bulk-import 72.46% <ø> (ø) Carriedforward from 1bd1997
cost-management 14.10% <ø> (ø) Carriedforward from 1bd1997
dcm 61.81% <ø> (ø) Carriedforward from 1bd1997
extensions 61.53% <ø> (ø) Carriedforward from 1bd1997
global-floating-action-button 71.18% <ø> (ø) Carriedforward from 1bd1997
global-header 59.71% <ø> (ø) Carriedforward from 1bd1997
homepage 50.23% <ø> (ø) Carriedforward from 1bd1997
install-dynamic-plugins 56.77% <ø> (ø) Carriedforward from 1bd1997
konflux 91.49% <ø> (ø) Carriedforward from 1bd1997
lightspeed 68.96% <100.00%> (+0.14%) ⬆️
mcp-integrations 85.46% <ø> (ø) Carriedforward from 1bd1997
orchestrator 39.47% <ø> (ø) Carriedforward from 1bd1997
quickstart 65.63% <ø> (ø) Carriedforward from 1bd1997
sandbox 79.56% <ø> (ø) Carriedforward from 1bd1997
scorecard 82.67% <ø> (ø) Carriedforward from 1bd1997
theme 61.26% <ø> (ø) Carriedforward from 1bd1997
translations 7.25% <ø> (ø) Carriedforward from 1bd1997
x2a 78.68% <ø> (ø) Carriedforward from 1bd1997

*This pull request uses carry forward flags. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 12b0c0b...409ac7b. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud

sonarqubecloud Bot commented Jul 6, 2026

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@its-mitesh-kumar

Copy link
Copy Markdown
Member Author

Cc: @HusneShabbir if you get time please check if atleast functionality is working properly. As it is first pr by bug-fix skill.

@HusneShabbir HusneShabbir left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@its-mitesh-kumar I agree that this is an edge-case scenario, but I think it's worth addressing as well.

Image

When the model dropdown is open and a message is sent, it's still possible to change the model mid-conversation. Please refer to the recording below.

It would be great if we could handle this case too and prevent the model from being changed while a conversation is in progress.

cc: @karthikjeeyar / @rohitkrai03

Screen.Recording.2026-07-06.at.8.37.29.PM.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants