Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

Stop promising a browser on the sign-in screen when none will open

shukieshah8871fa3ce957
diff --git a/cli/beacon/internal/onboarding/wizard.go b/cli/beacon/internal/onboarding/wizard.go
index c7217e54..bf385030 100644
--- a/cli/beacon/internal/onboarding/wizard.go
+++ b/cli/beacon/internal/onboarding/wizard.go
@@ -494,7 +494,14 @@ func (m wizardModel) View() string {
}
case signInScreen:
title = "Sign in to continue"
- body = "Beacon will open beacon.sh in your browser using a secure PKCE flow.\n\nSigning in does not send telemetry, register a managed endpoint, or enable forwarding."
+ // --no-browser means no browser will be opened, so promising one here sends
+ // an SSH or headless user looking for a window that never appears.
+ if m.options.NoBrowser {
+ body = "Beacon will show a beacon.sh URL to open yourself, using a secure PKCE flow."
+ } else {
+ body = "Beacon will open beacon.sh in your browser using a secure PKCE flow."
+ }
+ body += "\n\nSigning in does not send telemetry, register a managed endpoint, or enable forwarding."
case signInWaitScreen:
title = "Waiting for you to finish signing in"
switch {
@@ -670,16 +677,19 @@ func (m wizardModel) hint() string {
if m.screen == confirmScreen && m.result.Destination == DestinationAsymptote {
return "enter install and connect · esc cancel"
}
- return wizardHint(m.screen)
+ return m.wizardHint(m.screen)
}
-func wizardHint(screen wizardScreen) string {
+func (m wizardModel) wizardHint(screen wizardScreen) string {
switch screen {
case destinationScreen:
return "↑/↓ choose · enter continue · esc cancel"
case privacyScreen:
return "↑/↓ choose · enter continue · esc cancel"
case signInScreen:
+ if m.options.NoBrowser {
+ return "enter show the sign-in URL · esc cancel"
+ }
return "enter open beacon.sh · esc cancel"
case signInWaitScreen:
return "esc go back · ctrl+c cancel setup"
diff --git a/cli/beacon/internal/onboarding/wizard_test.go b/cli/beacon/internal/onboarding/wizard_test.go
index 2304cb33..a26cea68 100644
--- a/cli/beacon/internal/onboarding/wizard_test.go
+++ b/cli/beacon/internal/onboarding/wizard_test.go
@@ -609,3 +609,35 @@ func TestFinishingWithoutAnAccountDropsALeftoverIdentity(t *testing.T) {
t.Fatalf("confirm screen should say there is no account:\n%s", view)
}
}
+
+// --no-browser means no browser is opened, so the first screen must not promise
+// one. An SSH or headless user would otherwise go looking for a window that never
+// appears, and only learn the truth on the next screen.
+func TestSignInScreenHonorsNoBrowser(t *testing.T) {
+ withBrowser := newWizardModel(WizardOptions{OfferManaged: true})
+ withBrowser.screen = signInScreen
+ withBrowser.width, withBrowser.height = 100, 30
+ view := strings.Join(strings.Fields(withBrowser.View()), " ")
+ if !strings.Contains(view, "will open beacon.sh in your browser") || !strings.Contains(view, "enter open beacon.sh") {
+ t.Fatalf("default sign-in screen = %s", view)
+ }
+
+ headless := newWizardModel(WizardOptions{OfferManaged: true, NoBrowser: true})
+ headless.screen = signInScreen
+ headless.width, headless.height = 100, 30
+ view = strings.Join(strings.Fields(headless.View()), " ")
+ if strings.Contains(view, "will open beacon.sh in your browser") {
+ t.Fatalf("--no-browser screen still promises to open a browser:\n%s", view)
+ }
+ for _, want := range []string{"URL to open yourself", "enter show the sign-in URL"} {
+ if !strings.Contains(view, want) {
+ t.Fatalf("--no-browser screen missing %q:\n%s", want, view)
+ }
+ }
+ // Either way the screen offers no way around signing in.
+ for _, unwanted := range []string{"without an account", "Local only"} {
+ if strings.Contains(view, unwanted) {
+ t.Fatalf("sign-in screen must not advertise %q:\n%s", unwanted, view)
+ }
+ }
+}