Skip to content

fix(cli): suppress browser popup during auth via OPENSHELL_NO_BROWSER env var#419

Open
drew wants to merge 1 commit intomainfrom
suppress-browser-e2e/an
Open

fix(cli): suppress browser popup during auth via OPENSHELL_NO_BROWSER env var#419
drew wants to merge 1 commit intomainfrom
suppress-browser-e2e/an

Conversation

@drew
Copy link
Collaborator

@drew drew commented Mar 18, 2026

Summary

Add OPENSHELL_NO_BROWSER=1 environment variable to suppress the browser popup during the Cloudflare JWT auth flow. This prevents a browser window from opening when running e2e tests locally on macOS.

Related Issue

N/A — discovered during local e2e test runs.

Changes

  • crates/openshell-cli/src/auth.rs: Check OPENSHELL_NO_BROWSER env var (accepts "1" or "true") in browser_auth_flow(). When set, skip the stdin "Press Enter" prompt and the open_browser() call; print the auth URL to stderr instead.
  • e2e/rust/tests/cf_auth_smoke.rs: Set OPENSHELL_NO_BROWSER=1 in both run_isolated() and run_with_config() test helpers.

Testing

  • mise run pre-commit passes
  • cargo check -p openshell-cli compiles cleanly
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

… env var

The browser_auth_flow opens the system browser even when stdin is
piped/closed (e.g. in e2e tests), because read_line on a null stdin
returns immediately and execution continues to open_browser().

Add OPENSHELL_NO_BROWSER=1 environment variable support that skips both
the stdin prompt and the browser open call. The auth URL is still printed
to stderr so users in headless environments can authenticate manually.

Set the env var in the e2e test helpers to prevent browser popups when
running tests locally.
@drew drew requested a review from a team as a code owner March 18, 2026 01:28
@drew drew self-assigned this Mar 18, 2026
@drew drew requested review from johntmyers and pimlock March 18, 2026 04:02
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