Skip to content

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

Skip the forwarding question under install --connect

shukieshahddd771deadad
diff --git a/cli/beacon/cmd/endpoint_install.go b/cli/beacon/cmd/endpoint_install.go
index 61e17800..a43b5804 100644
--- a/cli/beacon/cmd/endpoint_install.go
+++ b/cli/beacon/cmd/endpoint_install.go
@@ -108,6 +108,8 @@ func runEndpointInstall(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ // --connect skips the question inside maybeRunOnboarding; either source of yes is
+ // recorded in the profile only after the connect below succeeds.
connectAfterInstall := acceptedOffer || endpointOpts.connect
result, err := lifecycle.Install(lifecycle.InstallOptions{
UserMode: endpointUserMode(),
@@ -141,7 +143,7 @@ func runEndpointInstall(cmd *cobra.Command, args []string) error {
fmt.Fprintln(cmd.OutOrStdout())
if err := connectEndpoint(cmd, endpointUserMode(), result.LogPath); err != nil {
fmt.Fprintf(cmd.ErrOrStderr(), "beacon: managed ingest was not connected (%v). Run `beacon endpoint connect` to try again.\n", err)
- } else if acceptedOffer {
+ } else {
recordManagedIngestAccepted(cmd)
}
}
diff --git a/cli/beacon/cmd/endpoint_onboarding.go b/cli/beacon/cmd/endpoint_onboarding.go
index b671160b..0555deb3 100644
--- a/cli/beacon/cmd/endpoint_onboarding.go
+++ b/cli/beacon/cmd/endpoint_onboarding.go
@@ -102,11 +102,14 @@ func maybeRunOnboarding(cmd *cobra.Command) (connect bool, err error) {
return false, nil
}
+ // `install --connect` is already the answer to the forwarding question, so the prompt
+ // does not ask it; the install records the yes once the connect succeeds.
+ offer := !endpointOpts.connect && managedIngestOfferableNow()
+
// Discovery shells out to every installed runtime, so start it now and collect it
// after the questions. The latency disappears behind the user reading and typing.
probe := onboardingProbeFn()
- offer := managedIngestOfferableNow()
answers, err := onboardingAskWith(onboardingStdin, cmd.OutOrStdout(), onboarding.PromptOptions{OfferManagedIngest: offer})
if err != nil {
return false, err
@@ -127,7 +130,7 @@ func maybeRunOnboarding(cmd *cobra.Command) (connect bool, err error) {
// maybeOfferManagedIngest asks the forwarding question alone, once, on an interactive
// install of a machine that was onboarded before the question existed.
func maybeOfferManagedIngest(cmd *cobra.Command, profile *onboarding.Profile) (bool, error) {
- if profile.Onboarding.ManagedIngest != "" {
+ if profile.Onboarding.ManagedIngest != "" || endpointOpts.connect {
return false, nil
}
if reason, skipped := managedIngestSkipReason(*profile); skipped {
@@ -149,12 +152,14 @@ func maybeOfferManagedIngest(cmd *cobra.Command, profile *onboarding.Profile) (b
return false, nil
}
-// recordManagedIngestAccepted stores the yes answer after `endpoint install` has connected
-// the machine. Until then the offer is unrecorded on purpose, so a failed install or
-// connect is retried by asking again rather than remembered as done.
+// recordManagedIngestAccepted stores the yes after `endpoint install` has connected the
+// machine, whether the yes came from the question or from --connect. Until then the offer
+// is unrecorded on purpose, so a failed install or connect is retried by asking again
+// rather than remembered as done. A recorded no is not overwritten: --connect on a machine
+// whose owner declined is an operator's action, not a change of the owner's answer.
func recordManagedIngestAccepted(cmd *cobra.Command) {
profile := onboardingLoad()
- if !profile.Prompted() {
+ if !profile.Prompted() || profile.Onboarding.ManagedIngest != "" {
return
}
profile.Onboarding.ManagedIngest = onboarding.ManagedIngestAccepted
diff --git a/cli/beacon/cmd/endpoint_onboarding_test.go b/cli/beacon/cmd/endpoint_onboarding_test.go
index 1009687f..494c7c33 100644
--- a/cli/beacon/cmd/endpoint_onboarding_test.go
+++ b/cli/beacon/cmd/endpoint_onboarding_test.go
@@ -675,6 +675,46 @@ func TestManagedIngestAcceptedIsRecordedAfterConnect(t *testing.T) {
if len(h5.saved) != 0 {
t.Fatalf("no profile should be written without a completed onboarding: %+v", h5.saved)
}
+
+ // A recorded no stays a no even when an operator connects with --connect.
+ h6 := newOnboardingHarness(t)
+ h6.loaded = onboarding.Profile{InstallID: "abc", Onboarding: onboarding.Onboarding{CompletedAt: "2026-08-01T00:00:00Z", ManagedIngest: onboarding.ManagedIngestDeclined}}
+ recordManagedIngestAccepted(h6.cmd)
+ if len(h6.saved) != 0 {
+ t.Fatalf("a declined answer must not be rewritten: %+v", h6.saved)
+ }
+}
+
+// --connect is already the answer: the question is not asked on either the first-run
+// prompt or an already-onboarded machine, so a default Enter can never record "declined"
+// on a machine the same command then connects.
+func TestInstallConnectFlagSkipsManagedIngestQuestion(t *testing.T) {
+ h := newOnboardingHarness(t)
+ h.offerable = true
+ endpointOpts.connect = true
+ t.Cleanup(func() { endpointOpts.connect = false })
+ if connect, err := maybeRunOnboarding(h.cmd); err != nil || connect {
+ t.Fatalf("connect=%t err=%v", connect, err)
+ }
+ if len(h.offered) != 1 || h.offered[0].OfferManagedIngest {
+ t.Fatalf("--connect must not add the question to the first-run prompt: %+v", h.offered)
+ }
+ if got := h.saved[len(h.saved)-1].Onboarding.ManagedIngest; got != "" {
+ t.Fatalf("recorded %q before the connect ran", got)
+ }
+
+ h = newOnboardingHarness(t)
+ h.offerable = true
+ h.loaded = onboarding.Profile{InstallID: "abc", Onboarding: onboarding.Onboarding{CompletedAt: "2026-08-01T00:00:00Z"}}
+ if connect, err := maybeRunOnboarding(h.cmd); err != nil || connect || h.standaloneAsked {
+ t.Fatalf("connect=%t err=%v asked=%t", connect, err, h.standaloneAsked)
+ }
+
+ // After the connect the install records the yes, exactly as for an answered question.
+ recordManagedIngestAccepted(h.cmd)
+ if got := h.saved[len(h.saved)-1].Onboarding.ManagedIngest; got != onboarding.ManagedIngestAccepted {
+ t.Fatalf("recorded choice = %q", got)
+ }
}
func TestInstallHasConnectFlag(t *testing.T) {