fix: preserve OAuth URLs in terminal auth flows#24853
fix: preserve OAuth URLs in terminal auth flows#24853Aaxhirrr wants to merge 1 commit intogoogle-gemini:mainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical UX issue where long OAuth login URLs were being corrupted or truncated when rendered in narrow terminal environments. By moving these URLs off the generic feedback message path and into a dedicated, structured display component, the changes ensure that auth URLs remain intact, copyable, and correctly formatted regardless of terminal width or UI state. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a structured mechanism for handling and displaying OAuth authentication URLs across the CLI and core packages. It replaces generic informational feedback with a dedicated OauthDisplayMessage event and a corresponding AuthUrlMessage UI component, ensuring that authentication links are consistently formatted and correctly persisted in the session history. Additionally, the PR refactors history-related type definitions by introducing HistoryItemWithoutId to replace repetitive Omit patterns, improving code maintainability. I have no feedback to provide as the changes are well-implemented and include comprehensive test coverage.
Summary
This PR fixes a high-priority auth UX bug where long OAuth login URLs were rendered through the generic info-message pipeline and became truncated or corrupted in narrow terminals. I replaced that with a dedicated auth URL display path that preserves every character across Google login, MCP OAuth, and A2A OAuth flows, and also added safe stdout fallbacks for non-interactive or pre-UI execution.
Details
OauthDisplayMessagePayloadwithheading,url, and optionalfooterLines.emitFeedback('info', ...)message path for Google browser login, MCP OAuth, and A2A OAuth.AuthUrlMessagecomponent for auth URL rendering.Textinstead ofInfoMessage, markdown parsing, or styled link rendering, since the previous path could drop characters at wrap boundaries in narrow terminals.60,50,40), long URLs with encoded parameters and repeated delimiters, exact URL reconstruction after wrapping, AppContainer event wiring, Google/MCP/A2A auth producer behavior, and MCP no-duplicate auth URL rendering.npm run buildnpm run lintnpm run typechecknpm run test:cion this Windows environment is still blocked by an unrelatedsea/sea-launch.test.jsruntime-permissions test outside the auth changes.Related Issues
Closes #12137
Related to #23769
How to Validate
npm run buildnpm run lintnpm run typecheckpackages/core:npx vitest run src/utils/events.test.ts src/utils/oauthDisplay.test.ts src/code_assist/oauth2.test.ts src/mcp/oauth-provider.test.ts src/agents/auth-provider/oauth2-provider.test.tspackages/cli:npx vitest run src/ui/components/messages/AuthUrlMessage.test.tsx src/ui/components/HistoryItemDisplay.test.tsx src/ui/AppContainer.test.tsx src/ui/commands/mcpCommand.test.ts40-60columns wide/mcp auth <server>oauth2Pre-Merge Checklist