Skip to content

Studio: declutter the chat plus menu and make RAG session-only with pre-select - #6140

Merged
danielhanchen merged 1 commit into
mainfrom
studio-plus-menu-rag-preselect
Jun 10, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-plus-menu-rag-preselect

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What this does

Plus menu

  • Moves Compare chat, Saved prompts and Export chat under the More submenu in both the thread composer and the compare mode composer. The top level is now just tools plus navigation: Add photos & files, Web search, Code, Chat with Files, MCP, More, Projects.
  • Renames the RAG menu row to "Chat with Files". The composer pill keeps the short RAG label.
  • Fixes the Code row label sitting a few px right of the other rows. The menu normalizes every icon to 1.05rem in index.css, but the Code glyph carried a size-[1.175rem]! override whose !important beat 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

  • The toggle now follows the same pre-select pattern as Web search, Code and MCP via a new useRagToolDisabled hook: armable with no model loaded, disabled only when a loaded model cannot run search_knowledge_base (external provider or no tool support). The send path already gates enabled_tools on supportsTools, so an armed toggle never leaks the tool into a request.
  • Session-only default: RAG always starts off and is no longer restored from localStorage. Retrieval source, mode and top k still persist.
  • The RAG pill shows whenever the toggle is on, not only once a local tool-capable model is loaded. It dims but stays interactive when the loaded model cannot run it, so it can always be turned off from the bar.
  • The "Add files to chat with" bar also shows whenever the toggle is on. Ingestion only needs the embedding model (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.
  • Removes the now unused useRagToolAvailable hook and renames the hook file to match its remaining export.

Testing

  • tsc -b and vite build pass. eslint on the touched files reports one fewer error than main (38 vs 39); every remaining one is pre-existing on untouched lines.
  • Exercised in a live Studio session with Chromium: top level and More submenu contents, label x offsets identical across all rows, RAG defaults to off even with a stale localStorage value, the pill and Add files bar appear with no model loaded, uploads still materialize a thread id on first use, and a reload resets RAG to off.

@gemini-code-assist gemini-code-assist Bot 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.

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;

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.

high

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:

  1. UX Lock-in Bug: In thread.tsx, the RAG pill is rendered unconditionally as long as ragEnabled is true. If an external model is loaded, the pill dims (ragDisabled is true) but remains visible, allowing the user to click the "X" to turn RAG off. In shared-composer.tsx, however, showRagPill is 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 when ragDisabled is true, the user is left with no way to turn off RAG in compare mode once an external model is active.
  2. Layout Overflow Bug (pillsCompact): Additionally, the pillsCompact calculation in shared-composer.tsx (around line 666) uses showRagPill && ragEnabled && !ragDisabled. Since the RAG pill now remains visible on screen even when dimmed (ragDisabled is true), it must always be counted in pillsCompact when rendered to prevent horizontal layout overflow.

Recommendation:

  • Set showRagPill to true to match the behavior of thread.tsx and allow users to toggle RAG off when it is dimmed.
  • Update the pillsCompact calculation (around line 666) to count the RAG pill whenever it is rendered (i.e., ragEnabled is true), rather than gating it on !ragDisabled.
Suggested change
const showRagPill = !isExternalModel;
const showRagPill = true;

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review


P2 Badge Keep the RAG off switch available after external load

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".

@danielhanchen
danielhanchen merged commit e4b5bec into main Jun 10, 2026
26 of 33 checks passed
@danielhanchen
danielhanchen deleted the studio-plus-menu-rag-preselect branch June 10, 2026 12:15
danielhanchen added a commit that referenced this pull request Jun 11, 2026
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.
danielhanchen added a commit that referenced this pull request Jun 11, 2026
…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.
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.

1 participant