fix: have login attempt to use browser and fallback to ticket instead of forcing tickets#8167
fix: have login attempt to use browser and fallback to ticket instead of forcing tickets#8167sean-roberts merged 2 commits intomainfrom
Conversation
… of forxing tickets
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request modifies the authentication flow across three files. The Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
📊 Benchmark resultsComparing with 8976f0b
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/base-command.ts (1)
523-535: De-duplicatecheck_commandconstruction to prevent drift.
netlify login --check ${ticketId}is built twice. Extracting once improves maintainability.♻️ Proposed refactor
if (!browserOpened && !isInteractive() && ticket.id) { const ticketId = ticket.id + const checkCommand = `netlify login --check ${ticketId}` logJson({ ticket_id: ticketId, url: authLink, - check_command: `netlify login --check ${ticketId}`, + check_command: checkCommand, agent_next_steps: 'Give the URL to the user so they can authorize. Then poll the check_command for up to ten minutes to see if the user has logged in, or wait for them to tell you and then use check_command after.', }) log(`Ticket ID: ${ticketId}`) log(`Authorize URL: ${authLink}`) log() - log(`After authorizing, run: netlify login --check ${ticketId}`) + log(`After authorizing, run: ${checkCommand}`) log() log('After user opens the authorization URL and approves, the login will be complete.') return exit() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/base-command.ts` around lines 523 - 535, The check command string is constructed twice causing potential drift; create a single variable (e.g., checkCommand) after ticketId is set and use that variable in the logJson payload (check_command) and in the subsequent log calls (the "After authorizing, run:" line) instead of interpolating `netlify login --check ${ticketId}` inline; update references around ticketId, logJson, and log to use checkCommand.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/commands/base-command.ts`:
- Around line 523-535: The check command string is constructed twice causing
potential drift; create a single variable (e.g., checkCommand) after ticketId is
set and use that variable in the logJson payload (check_command) and in the
subsequent log calls (the "After authorizing, run:" line) instead of
interpolating `netlify login --check ${ticketId}` inline; update references
around ticketId, logJson, and log to use checkCommand.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b1335338-40d6-4416-8ffd-388df64bb227
📒 Files selected for processing (3)
src/commands/base-command.tssrc/commands/login/login.tssrc/utils/open-browser.ts
💤 Files with no reviewable changes (1)
- src/commands/login/login.ts
🤖 I have created a release *beep* *boop* --- ## [25.0.1](v25.0.0...v25.0.1) (2026-04-17) ### Bug Fixes * have login attempt to use browser and fallback to ticket instead of forcing tickets ([#8167](#8167)) ([7da602c](7da602c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
Try browser-based auth first in non-interactive environments before falling back to the agent copy/paste flow. Previously, non-interactive sessions (CI, piped input, etc.) skipped the browser entirely and went straight to the ticket/URL output. Now we attempt to open the browser and only fall back to the agent-friendly flow if it fails.
This should help agents that allow a graceful timeout situation to have a good experience
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)