Skip to content
This repository was archived by the owner on Feb 15, 2026. It is now read-only.

fix: prevent login from hanging in CLI environments#3

Merged
NicolasRitouet merged 1 commit intokeywaysh:mainfrom
Alan-221b:fix/login-browser-blocking
Jan 5, 2026
Merged

fix: prevent login from hanging in CLI environments#3
NicolasRitouet merged 1 commit intokeywaysh:mainfrom
Alan-221b:fix/login-browser-blocking

Conversation

@Alan-221b
Copy link
Copy Markdown
Contributor

Fixes #1

Summary

  • Run browser.OpenURL() in a goroutine to avoid blocking
  • Add helpful message for manual URL copying when browser doesn't open

Problem

When running keyway login in certain CLI environments (VS Code integrated terminal, SSH sessions, headless servers), the login flow hangs after displaying the verification URL. The CLI never starts polling for OAuth completion.

Root Cause

The browser.OpenURL() call blocks in these environments, waiting for the browser process to complete, which prevents the polling loop from starting.

Before

│ Code: ABCD-1234
│ Open: https://api.keyway.sh/v1/auth/device/verify?user_code=ABCD-1234
[hangs indefinitely - no "Waiting for authorization..." spinner]

After

│ Code: ABCD-1234
│ Open: https://api.keyway.sh/v1/auth/device/verify?user_code=ABCD-1234
│ If the browser doesn't open, copy the URL above and paste it in your browser.
[polling starts immediately]

Test Plan

  • Test keyway login in VS Code integrated terminal
  • Test keyway login in standard terminal (macOS/Linux)
  • Test keyway login via SSH session
  • Verify OAuth flow completes successfully after browser authorization

- Run browser.OpenURL() in a goroutine to avoid blocking
- Add helpful message for manual URL copying when browser doesn't open
- Fixes issue where login hangs in VS Code terminal, SSH sessions, and headless environments

The browser.OpenURL() function can block indefinitely in certain CLI environments,
preventing the OAuth polling loop from starting. This change makes the browser
opening non-blocking so the CLI can immediately start polling for completion.
@NicolasRitouet
Copy link
Copy Markdown
Member

@Alan-221b thanks a lot for your contribution.
your changes will be released today 🎉

@NicolasRitouet NicolasRitouet merged commit 2efe56f into keywaysh:main Jan 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login hangs in headless/CLI environments

2 participants