Skip to content

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

status: report managed ingest for the requested install mode

shukieshahd50a187ac0a1
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index a9a2f331..6cfe4b19 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -561,6 +561,16 @@ func GetStatus(userMode bool, logPath string) Status {
effectiveCfg = loadOrDefault(runtimeLog.EffectiveUserMode, runtimeLog.EffectiveLogPath)
}
effectiveCfg.LogPath = runtimeLog.EffectiveLogPath
+ return buildStatus(userMode, effectiveCfg, runtimeLog, asymptote.StatusOptions{})
+}
+
+// buildStatus assembles the status from the effective collector configuration. Everything
+// about the collector and the runtime log follows effectiveCfg, which may have switched to
+// the system install when its collector holds the OTLP ports. Managed ingest does not: a
+// connection belongs to the install the caller asked about (`--user` or `--system`), each
+// mode keeps its own enrollment and forwarder, and the system record is unreadable
+// without root anyway.
+func buildStatus(requestedUserMode bool, effectiveCfg endpointconfig.Config, runtimeLog RuntimeLogSource, managedOpts asymptote.StatusOptions) Status {
last, _ := writer.LastLine(effectiveCfg.LogPath)
checks := diagnostics.Run(effectiveCfg)
if runtimeLog.Warning != "" {
@@ -582,7 +592,7 @@ func GetStatus(userMode bool, logPath string) Status {
Diagnostics: checks,
LastEvent: last,
Destinations: destinationStatus(effectiveCfg),
- ManagedIngest: asymptote.Status(effectiveCfg.UserMode, asymptote.StatusOptions{}),
+ ManagedIngest: asymptote.Status(requestedUserMode, managedOpts),
}
}
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
index 8849c545..69bd18ec 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
@@ -10,6 +10,7 @@ import (
"strings"
"testing"
+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/asymptote"
endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/harness"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/schema"
@@ -906,6 +907,30 @@ func TestDestinationStatusAndInstallDestinationReportEnabledHEC(t *testing.T) {
}
}
+// `status --user` on a machine whose system collector holds the OTLP ports switches the
+// runtime-log view to the system install, but the managed-ingest connection it reports must
+// still be the user's: each mode has its own enrollment, and the system one is root-only.
+func TestStatusReportsManagedIngestForRequestedMode(t *testing.T) {
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ if err := asymptote.SaveEnrollment(true, asymptote.Enrollment{InstallID: "i", IngestURL: "https://ingest.example", DeviceID: "user-device", OrganizationID: "org", OrganizationName: "Org"}); err != nil {
+ t.Fatal(err)
+ }
+ if err := os.WriteFile(asymptote.VectorConfigPath(true), []byte("# rendered"), 0o644); err != nil {
+ t.Fatal(err)
+ }
+ systemCfg := endpointconfig.Default(false, filepath.Join(home, "system", "runtime.jsonl"))
+ runtimeLog := RuntimeLogSource{RequestedUserMode: true, EffectiveUserMode: false, EffectiveLogPath: systemCfg.LogPath}
+
+ status := buildStatus(true, systemCfg, runtimeLog, asymptote.StatusOptions{SkipCredentialCheck: true})
+ if !status.ManagedIngest.Enabled || status.ManagedIngest.DeviceID != "user-device" {
+ t.Fatalf("status --user must report the user-mode connection, got %+v", status.ManagedIngest)
+ }
+ if status.LogPath != systemCfg.LogPath {
+ t.Fatalf("runtime log view should still follow the effective (system) config, got %q", status.LogPath)
+ }
+}
+
func TestGetStatusAndResolveRuntimeLogReportRequestedConfig(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)