fix(cli): suppress browser popup during auth via OPENSHELL_NO_BROWSER env var#419
Merged
fix(cli): suppress browser popup during auth via OPENSHELL_NO_BROWSER env var#419
Conversation
… 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.
pimlock
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
OPENSHELL_NO_BROWSER=1environment 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: CheckOPENSHELL_NO_BROWSERenv var (accepts"1"or"true") inbrowser_auth_flow(). When set, skip the stdin "Press Enter" prompt and theopen_browser()call; print the auth URL to stderr instead.e2e/rust/tests/cf_auth_smoke.rs: SetOPENSHELL_NO_BROWSER=1in bothrun_isolated()andrun_with_config()test helpers.Testing
mise run pre-commitpassescargo check -p openshell-clicompiles cleanlyChecklist