Skip to content

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

fix(cli): resend a queued signup on endpoint repair

shukieshah81da01a0ff93
diff --git a/cli/beacon/cmd/endpoint_install.go b/cli/beacon/cmd/endpoint_install.go
index 834a8e30..ef1c8139 100644
--- a/cli/beacon/cmd/endpoint_install.go
+++ b/cli/beacon/cmd/endpoint_install.go
@@ -249,6 +249,9 @@ func runEndpointRepair(cmd *cobra.Command, args []string) error {
if endpointOpts.dryRun {
return printPlannedActions(plannedInstallActions(true, serviceKind))
}
+ // Resend only. Repair is a maintenance command and never asks a question, but a
+ // signup that failed on a flaky network deserves the retry the docs promise.
+ retryPendingOnboarding()
result, err := lifecycle.Repair(lifecycle.InstallOptions{
UserMode: endpointUserMode(),
LogPath: endpointOpts.logPath,
diff --git a/cli/beacon/cmd/endpoint_onboarding.go b/cli/beacon/cmd/endpoint_onboarding.go
index 16b0cf1c..cb2d3ba9 100644
--- a/cli/beacon/cmd/endpoint_onboarding.go
+++ b/cli/beacon/cmd/endpoint_onboarding.go
@@ -221,6 +221,20 @@ func completeOnboarding(cmd *cobra.Command, profile *onboarding.Profile, email,
}
}
+// retryPendingOnboarding resends a queued signup without ever prompting.
+//
+// Called from `endpoint repair`, which is a maintenance command and must never ask a
+// question -- including of someone who has not been through onboarding at all. It only
+// gives a submission that failed on a flaky network a second chance, which is what the
+// docs promise.
+func retryPendingOnboarding() {
+ profile := onboardingLoad()
+ if !profile.Prompted() || profile.Pending == nil {
+ return
+ }
+ resendPendingOnboarding(&profile)
+}
+
// resendPendingOnboarding retries a submission that previously failed. Best effort
// and silent: the user already answered and must not be bothered about it again.
func resendPendingOnboarding(profile *onboarding.Profile) {
diff --git a/cli/beacon/cmd/endpoint_onboarding_test.go b/cli/beacon/cmd/endpoint_onboarding_test.go
index fee8c3d7..6fd06e56 100644
--- a/cli/beacon/cmd/endpoint_onboarding_test.go
+++ b/cli/beacon/cmd/endpoint_onboarding_test.go
@@ -461,3 +461,48 @@ func TestOnboardingEnabledByEnv(t *testing.T) {
}
}
}
+
+// Repair must resend a queued signup -- the docs promise it -- but must never prompt,
+// including for someone who has not been through onboarding at all.
+func TestRetryPendingOnboardingResendsWithoutPrompting(t *testing.T) {
+ h := newOnboardingHarness(t)
+ pending := onboarding.Submission{InstallID: "abc123", Email: "[email protected]"}
+ h.loaded = onboarding.Profile{
+ InstallID: "abc123",
+ Onboarding: onboarding.Onboarding{CompletedAt: "2026-08-07T00:00:00Z", Outcome: onboarding.OutcomePending},
+ Pending: &pending,
+ }
+
+ retryPendingOnboarding()
+
+ if h.asked {
+ t.Fatalf("repair prompted for onboarding")
+ }
+ if len(h.sent) != 1 || h.sent[0].InstallID != "abc123" {
+ t.Fatalf("sent = %+v, want the pending payload resent once", h.sent)
+ }
+ if len(h.saved) != 1 || h.saved[0].Pending != nil {
+ t.Fatalf("saved = %+v, want the payload cleared after delivery", h.saved)
+ }
+}
+
+func TestRetryPendingOnboardingIsSilentWithNothingQueued(t *testing.T) {
+ for name, profile := range map[string]onboarding.Profile{
+ "never onboarded": {},
+ "onboarded, no queue": {Onboarding: onboarding.Onboarding{CompletedAt: "2026-08-07T00:00:00Z", Outcome: onboarding.OutcomeSubmitted}},
+ } {
+ t.Run(name, func(t *testing.T) {
+ h := newOnboardingHarness(t)
+ h.loaded = profile
+
+ retryPendingOnboarding()
+
+ if h.asked {
+ t.Fatalf("repair prompted for onboarding")
+ }
+ if len(h.sent) != 0 || len(h.saved) != 0 {
+ t.Fatalf("repair touched the network or disk: sent=%d saved=%d", len(h.sent), len(h.saved))
+ }
+ })
+ }
+}
diff --git a/packaging/macos/smoke-endpoint.sh b/packaging/macos/smoke-endpoint.sh
index 6a74e774..4ba9fc6b 100755
--- a/packaging/macos/smoke-endpoint.sh
+++ b/packaging/macos/smoke-endpoint.sh
@@ -75,7 +75,9 @@ test -f "$LOG_PATH"
# A non-interactive install must never ask for an email or record an onboarding
# answer. Package postinstall scripts, MDM deployments, and CI all reach `endpoint
# install` without a terminal, so a prompt here is a broken fleet rollout.
-if grep -qi 'How are you using Beacon\|^Email:' "$INSTALL_OUTPUT"; then
+# -E because the prompt strings are matched as alternates, and the second branch is
+# the current email prompt ("Email › "), not the old "Email:".
+if grep -qiE 'How are you using Beacon|Email .|free and open source' "$INSTALL_OUTPUT"; then
echo "non-interactive endpoint install must not prompt for onboarding" >&2
cat "$INSTALL_OUTPUT" >&2
exit 1