The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
fix(status): show customer forwarders and stop telling MDM installs to connect
shukieshah6a6830f18d93
diff --git a/cli/beacon/cmd/endpoint_connect.go b/cli/beacon/cmd/endpoint_connect.goindex e058438c..6bd9f817 100644--- a/cli/beacon/cmd/endpoint_connect.go+++ b/cli/beacon/cmd/endpoint_connect.go@@ -17,6 +17,7 @@ import ("github.com/asymptote-labs/agent-beacon/cli/beacon/internal/auth""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/asymptote""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/lifecycle"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/service""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/managedprivacy""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/onboarding""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/version"@@ -272,6 +273,39 @@ func connectBrowserOpener(userMode bool) func(string) error {}}+// cloudStatusLine is the Beacon Cloud line of `beacon endpoint status`, or "" when it has nothing+// to say.+//+// A connected or half-connected endpoint always gets the line. An unconnected one gets it only on a+// per-user install that sends nowhere else: a system install is an MDM or package rollout, often+// forwarding to the customer's own S3, GCS or Falcon, and its hint, a per-user+// `beacon endpoint connect`, fails there for want of a personal sign-in. Admins read that line as+// a step left undone.+func cloudStatusLine(status asymptote.ManagedIngestStatus, userMode, ownForwarder bool) string {+ if !status.Enabled && status.Message == "" && (!userMode || ownForwarder) {+ return ""+ }+ return managedIngestStatusLine(status)+}++// scriptForwarderStatusLine renders one package-helper forwarder for `beacon endpoint status`.+func scriptForwarderStatusLine(status service.Status) string {+ name := status.Label+ switch status.Label {+ case "com.beacon.endpoint.s3-forwarder":+ name = "S3 forwarder"+ case "com.beacon.endpoint.gcs-forwarder":+ name = "GCS forwarder"+ case "com.beacon.endpoint.falcon-forwarder":+ name = "Falcon LogScale forwarder"+ }+ line := fmt.Sprintf("%s: loaded=%t running=%t", name, status.Loaded, status.Running)+ if !status.Loaded && status.Message != "" {+ line += " (" + status.Message + ")"+ }+ return line+}+// managedIngestStatusLine renders the human status line for `beacon endpoint status`.// dashboardHomeURL turns the recorded service URL into the page a person can// actually open.diff --git a/cli/beacon/cmd/endpoint_connect_test.go b/cli/beacon/cmd/endpoint_connect_test.goindex e7c2538c..bed146ac 100644--- a/cli/beacon/cmd/endpoint_connect_test.go+++ b/cli/beacon/cmd/endpoint_connect_test.go@@ -222,3 +222,35 @@ func TestHumanBytes(t *testing.T) {}}}++func TestCloudStatusLineOnlyWhereBeaconCloudApplies(t *testing.T) {+ notConnected := asymptote.ManagedIngestStatus{}+ if line := cloudStatusLine(notConnected, false, false); line != "" {+ t.Errorf("system install, not connected: line = %q, want none (MDM rollouts should not be told to connect)", line)+ }+ if line := cloudStatusLine(notConnected, true, true); line != "" {+ t.Errorf("own forwarder, not connected: line = %q, want none", line)+ }+ if line := cloudStatusLine(notConnected, true, false); !strings.Contains(line, "beacon endpoint connect") {+ t.Errorf("per-user install, not connected: line = %q, want the connect hint", line)+ }+ connected := asymptote.ManagedIngestStatus{Enabled: true, DeviceID: "dev-1"}+ if line := cloudStatusLine(connected, false, true); !strings.Contains(line, "Beacon Cloud: connected") {+ t.Errorf("system install, connected: line = %q, want the connected line", line)+ }+ pending := asymptote.ManagedIngestStatus{Message: "connect did not finish"}+ if line := cloudStatusLine(pending, false, false); !strings.Contains(line, "connect did not finish") {+ t.Errorf("system install, incomplete connect: line = %q, want its message", line)+ }+}++func TestScriptForwarderStatusLine(t *testing.T) {+ running := scriptForwarderStatusLine(service.Status{Label: "com.beacon.endpoint.s3-forwarder", Loaded: true, Running: true})+ if running != "S3 forwarder: loaded=true running=true" {+ t.Errorf("running line = %q", running)+ }+ missing := scriptForwarderStatusLine(service.Status{Label: "com.beacon.endpoint.gcs-forwarder", Message: "Could not find service"})+ if missing != "GCS forwarder: loaded=false running=false (Could not find service)" {+ t.Errorf("not loaded line = %q", missing)+ }+}diff --git a/cli/beacon/cmd/endpoint_install.go b/cli/beacon/cmd/endpoint_install.goindex da4bb933..010e0ddb 100644--- a/cli/beacon/cmd/endpoint_install.go+++ b/cli/beacon/cmd/endpoint_install.go@@ -273,7 +273,12 @@ func runEndpointStatus(cmd *cobra.Command, args []string) error {} else {fmt.Println("Last event: present")}- fmt.Println(managedIngestStatusLine(status.ManagedIngest))+ for _, forwarder := range status.ScriptForwarders {+ fmt.Println(scriptForwarderStatusLine(forwarder))+ }+ if line := cloudStatusLine(status.ManagedIngest, endpointUserMode(), len(status.ScriptForwarders) > 0); line != "" {+ fmt.Println(line)+ }fmt.Println(inventoryHeartbeatStatusLine(status.InventoryHeartbeat))return nil}diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex ec624e48..59f0a059 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -54,6 +54,8 @@ var (// helpers install, so tests can see whether an uninstall reaches them without touching// /Library.removeScriptForwarders = service.RemoveScriptForwarders+ // scriptForwarderStatuses is the seam for reading those forwarders' state in GetStatus.+ scriptForwarderStatuses = service.ScriptForwarderStatuses// reconcileManagedForwarder is the seam for the Beacon Cloud forwarder reconcile, so tests can// see whether Install reaches it without a connected endpoint or a service manager.reconcileManagedForwarder = func(userMode bool, logPath string) (asymptote.ReconcileResult, error) {@@ -268,6 +270,9 @@ type Status struct {ManagedIngest asymptote.ManagedIngestStatus `json:"managed_ingest"`// InventoryHeartbeat follows the requested mode, like ManagedIngest: each mode has its own job.InventoryHeartbeat InventoryHeartbeatStatus `json:"inventory_heartbeat"`+ // ScriptForwarders are the S3, GCS and Falcon forwarders the package helpers install, one entry+ // per forwarder that is set up on this machine.+ ScriptForwarders []service.Status `json:"script_forwarders,omitempty"`}type DestinationStatus struct {@@ -893,6 +898,7 @@ func buildStatus(requestedUserMode bool, effectiveCfg endpointconfig.Config, runDestinations: destinationStatus(effectiveCfg),ManagedIngest: asymptote.Status(requestedUserMode, managedOpts),InventoryHeartbeat: inventoryHeartbeatStatus(requestedUserMode, runtimeLog.RequestedLogPath),+ ScriptForwarders: scriptForwarderStatuses(),}}diff --git a/cli/beacon/internal/endpoint/service/script_forwarders.go b/cli/beacon/internal/endpoint/service/script_forwarders.goindex a1a24918..57e4cd12 100644--- a/cli/beacon/internal/endpoint/service/script_forwarders.go+++ b/cli/beacon/internal/endpoint/service/script_forwarders.go@@ -6,6 +6,7 @@ import ("os""path/filepath""runtime"+ "strings")// The S3, GCS and Falcon forwarders are installed by the shell helpers the macOS package ships@@ -87,3 +88,28 @@ func RestoreScriptForwarders() error {}return errors.Join(errs...)}++// ScriptForwarderStatuses reports each package-helper forwarder whose LaunchDaemon is on disk, so+// `beacon endpoint status` can show the forwarder a customer set up to send to their own S3, GCS+// or Falcon LogScale. A forwarder that was never set up is left out.+func ScriptForwarderStatuses() []Status {+ if runtime.GOOS != "darwin" {+ return nil+ }+ var statuses []Status+ for _, label := range ScriptForwarderLabels {+ if _, err := os.Stat(scriptForwarderPlistPath(label)); err != nil {+ continue+ }+ status := Status{Label: label, Kind: string(KindLaunchd)}+ out, err := runLaunchctlCommand("print", "system/"+label)+ if err != nil {+ status.Message = strings.TrimSpace(out)+ } else {+ status.Loaded = true+ status.Running = strings.Contains(out, "state = running") || strings.Contains(out, "pid =")+ }+ statuses = append(statuses, status)+ }+ return statuses+}diff --git a/cli/beacon/internal/endpoint/service/script_forwarders_test.go b/cli/beacon/internal/endpoint/service/script_forwarders_test.goindex 1b1a3d0d..2a2b198d 100644--- a/cli/beacon/internal/endpoint/service/script_forwarders_test.go+++ b/cli/beacon/internal/endpoint/service/script_forwarders_test.go@@ -97,3 +97,24 @@ func TestRestoreScriptForwardersLoadsOnlyInstalledOnes(t *testing.T) {t.Errorf("launchctl calls = %v, want %v", *calls, want)}}++func TestScriptForwarderStatusesReportsOnlyInstalledForwarders(t *testing.T) {+ _, calls := scriptForwarderFixture(t, "com.beacon.endpoint.s3-forwarder")++ statuses := ScriptForwarderStatuses()+ if len(statuses) != 1 || statuses[0].Label != "com.beacon.endpoint.s3-forwarder" {+ t.Fatalf("statuses = %+v, want only the installed S3 forwarder", statuses)+ }+ if statuses[0].Loaded || statuses[0].Running || statuses[0].Message == "" {+ t.Errorf("status = %+v, want not loaded with launchctl's message", statuses[0])+ }+ if want := "print system/com.beacon.endpoint.s3-forwarder"; strings.Join(*calls, "|") != want {+ t.Errorf("launchctl calls = %v, want %q", *calls, want)+ }++ runLaunchctlCommand = func(args ...string) (string, error) { return "\tstate = running\n\tpid = 42\n", nil }+ statuses = ScriptForwarderStatuses()+ if len(statuses) != 1 || !statuses[0].Loaded || !statuses[0].Running {+ t.Errorf("statuses = %+v, want the S3 forwarder loaded and running", statuses)+ }+}diff --git a/docs/cli/endpoint-connect.mdx b/docs/cli/endpoint-connect.mdxindex 845b4c99..5df21555 100644--- a/docs/cli/endpoint-connect.mdx+++ b/docs/cli/endpoint-connect.mdx@@ -166,7 +166,7 @@ beacon endpoint disconnect## Checking the connection-`beacon endpoint status` prints one line for managed ingest: whether this endpoint is connected, organization and device identity, active privacy mode, forwarder state, credential validity, and disk-buffer size. `--json` exposes the same under `managed_ingest`.+`beacon endpoint status` prints one line for managed ingest: whether this endpoint is connected, organization and device identity, active privacy mode, forwarder state, credential validity, and disk-buffer size. `--json` exposes the same under `managed_ingest`. A system install that was never connected, usually an MDM rollout, leaves the line out, as does any install that forwards to its own S3, GCS or Falcon LogScale; status lists those forwarders instead.```textBeacon Cloud: connected to Beacon Test as device 807c6a11-…; forwarder loaded=true running=true; privacy Metadata only; credential validdiff --git a/docs/guides/fleet-s3-mdm.mdx b/docs/guides/fleet-s3-mdm.mdxindex 03c20d21..66d2f0d7 100644--- a/docs/guides/fleet-s3-mdm.mdx+++ b/docs/guides/fleet-s3-mdm.mdx@@ -346,7 +346,7 @@ Harness: Codex CLI <version> telemetry=enabledLast event: present```-`running=true` and `telemetry=enabled` are the lines that matter. A line reading `Beacon Cloud: not connected` is expected: Beacon's hosted service isn't used in this setup.+`running=true` and `telemetry=enabled` are the lines that matter. Once step 5 has run, a line reading `S3 forwarder: loaded=true running=true` appears too. Older versions also print `Beacon Cloud: not connected`. Ignore it: Beacon's hosted service isn't used in this setup.<Note>The package configures the agents of whoever is logged in at the Mac when it installs. If nobody was logged in, for example during Setup Assistant, run this after someone logs in, either as a Fleet script or on the Mac:diff --git a/docs/platforms/linux.mdx b/docs/platforms/linux.mdxindex 17fc98c5..264e7caf 100644--- a/docs/platforms/linux.mdx+++ b/docs/platforms/linux.mdx@@ -100,11 +100,10 @@ Collector: grpc=true http=trueService: loaded=true running=trueHarness: Claude Code telemetry=enabledLast event: present-Beacon Cloud: not connected (run `beacon endpoint connect`)Inventory heartbeat: scheduled every 6h0m0s; job loaded=true running=true; last emitted never```-`running=true` and `telemetry=enabled` are the lines that matter. Then run your agent as usual (see [Using it](#using-it)) and its events land in the runtime log. `Beacon Cloud: not connected` is expected, because a package install keeps everything on this machine.+`running=true` and `telemetry=enabled` are the lines that matter. Then run your agent as usual (see [Using it](#using-it)) and its events land in the runtime log.### If something looks wrong