Skip to content

feat(cli): open browser for device login - #108

Merged
mrchtr merged 1 commit into
mainfrom
feat/device-login-open-browser
Oct 26, 2026
Merged

mrchtr merged 1 commit into
mainfrom
feat/device-login-open-browser

Conversation

@mrchtr

@mrchtr mrchtr commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Proposed Changes?

haystack-enterprise login (device flow, now the default) only printed the verification link and code, so you had to click or copy it. It now also tries to open the link in a browser, the same way the --no-device browser login already does. The printed link and code stay as the fallback.

Over SSH (SSH_CONNECTION set) it doesn't try, because the only browser there would be a text-mode one like lynx or w3m that would take over the terminal while the CLI waits for approval.

How did you test it?

  • New unit test test_show_device_code_opens_browser_unless_over_ssh: the browser opens with the full verification URL normally and is skipped over SSH.
  • make all-fix, make types, make tests-unit pass (840 passed, 1 skipped).
  • Not yet tried with a real login.

Notes for the reviewer

webbrowser.open returns False without raising when there's no browser (containers, headless machines), so nothing changes in those environments.

Checklist

  • I have updated the referenced issue with new insights and changes
  • If this is a code change, I have added unit tests
  • I've used the conventional commit specification for my PR title
  • I updated the docstrings
  • If this is a code change, I added meaningful logs and prepared Datadog visualizations and alerts

The device login now tries to open the verification URL in a browser and
keeps the printed link and code as the fallback. Over SSH it skips this,
because the only browser there would be a console one that takes over
the terminal.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W33GYKjNWdZciXus4hh2HT
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  haystack_enterprise_sdk
  cli.py
Project Total  

This report was generated by python-coverage-comment-action

@mrchtr
mrchtr enabled auto-merge (squash) October 26, 2026 09:04
@mrchtr
mrchtr merged commit 2113194 into main Oct 26, 2026
6 checks passed
@mrchtr
mrchtr deleted the feat/device-login-open-browser branch October 26, 2026 09:04
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.

2 participants