Repository navigation
Studio: declutter the chat plus menu and make RAG session-only with pre-select - #6140
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the RAG (Retrieval-Augmented Generation) tool's state management and UI behavior. RAG is now session-based and no longer persisted in storage. The RAG pill and document bar are now displayed whenever RAG is enabled, even if the loaded model does not support it (dimming the UI instead of hiding it so users can still disable it). Additionally, the dropdown menus in both the single-chat and compare-mode composers have been reorganized to move several items under a "More" submenu, and "RAG" has been renamed to "Chat with Files". Feedback was provided regarding a UX lock-in bug in compare mode where the RAG pill is hidden when an external model is loaded, preventing users from turning it off.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // Disable only when a loaded model can't run it; with no model the toggle | ||
| // can still be pre-selected, matching Web search/Code/MCP. | ||
| const ragDisabled = modelLoaded && (isExternalModel || !supportsTools); | ||
| const showRagPill = !isExternalModel; |
There was a problem hiding this comment.
Inconsistency & UX Lock-in with RAG Pill in Compare Mode
There is a discrepancy between the single-chat composer (thread.tsx) and the compare-mode composer (shared-composer.tsx) regarding how the RAG pill is displayed and interacted with when an external model is loaded:
- UX Lock-in Bug: In
thread.tsx, the RAG pill is rendered unconditionally as long asragEnabledistrue. If an external model is loaded, the pill dims (ragDisabledistrue) but remains visible, allowing the user to click the "X" to turn RAG off. Inshared-composer.tsx, however,showRagPillis gated on!isExternalModel. When an external model is loaded, the RAG pill is completely hidden. Since the "Chat with Files" dropdown menu item is also disabled whenragDisabledistrue, the user is left with no way to turn off RAG in compare mode once an external model is active. - Layout Overflow Bug (
pillsCompact): Additionally, thepillsCompactcalculation inshared-composer.tsx(around line 666) usesshowRagPill && ragEnabled && !ragDisabled. Since the RAG pill now remains visible on screen even when dimmed (ragDisabledistrue), it must always be counted inpillsCompactwhen rendered to prevent horizontal layout overflow.
Recommendation:
- Set
showRagPilltotrueto match the behavior ofthread.tsxand allow users to toggle RAG off when it is dimmed. - Update the
pillsCompactcalculation (around line 666) to count the RAG pill whenever it is rendered (i.e.,ragEnabledistrue), rather than gating it on!ragDisabled.
| const showRagPill = !isExternalModel; | |
| const showRagPill = true; |
There was a problem hiding this comment.
💡 Codex Review
In the compare/shared composer, a user can now pre-select Chat with Files before any model is loaded; if they then load an external model, ragDisabled becomes true, showRagPill = !isExternalModel hides the KnowledgeBaseComposerButton off switch, and this disabled menu row can no longer call setRagEnabled(false). That leaves RAG stuck on in the composer until the user reloads or switches back to a local tool-capable model, even though the send path will not actually include the tool.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR #6153 taught the chat UI driver to find Compare chat inside the decluttered plus menu (#6140) but the extra UI driver kept looking for the old top-level item, so all three Studio UI CI workflows have been red on main since (Compare nav not found). Mirror the same hover-then-click More fallback here.
…er (#6177) PR #6153 taught the chat UI driver to find Compare chat inside the decluttered plus menu (#6140) but the extra UI driver kept looking for the old top-level item, so all three Studio UI CI workflows have been red on main since (Compare nav not found). Mirror the same hover-then-click More fallback here.
What this does
Plus menu
size-[1.175rem]!override whose!importantbeat that rule and widened its layout box. It is now a scale transform, so the glyph keeps its optical size while the box stays the standard width. All seven labels measure the exact same x offset.RAG
useRagToolDisabledhook: armable with no model loaded, disabled only when a loaded model cannot runsearch_knowledge_base(external provider or no tool support). The send path already gatesenabled_toolsonsupportsTools, so an armed toggle never leaks the tool into a request.core/rag/ingestion.py), so documents can parse and index while a chat model is still loading and are ready for retrieval the moment one is up.useRagToolAvailablehook and renames the hook file to match its remaining export.Testing
tsc -bandvite buildpass. eslint on the touched files reports one fewer error than main (38 vs 39); every remaining one is pre-existing on untouched lines.