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
Keep config.json through repair so managed_ingest survives
Claudeb237afeb8887
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex 1b651040..55398622 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -668,7 +668,14 @@ func Uninstall(opts UninstallOptions) error {if !opts.KeepConfig {restoreBackups(manifest.Backups)}+ // KeepConfig (repair) keeps config.json so the reinstall carries over what connect,+ // disconnect and the operator own in it (managed_ingest, inventory, auto_update); without it+ // a repaired endpoint that kept forwarding read as unconnected on disk.+ endpointConfigPath := endpointconfig.ConfigPath(cfg.UserMode)for _, path := range manifest.Files {+ if opts.KeepConfig && path == endpointConfigPath {+ continue+ }fail("remove "+path, os.Remove(path))}if len(manifest.Files) == 0 {@@ -676,7 +683,9 @@ func Uninstall(opts UninstallOptions) error {fail("remove "+path, os.Remove(path))}fail("remove "+cfg.Collector.ConfigPath, os.Remove(cfg.Collector.ConfigPath))- fail("remove endpoint config", os.Remove(endpointconfig.ConfigPath(cfg.UserMode)))+ if !opts.KeepConfig {+ fail("remove endpoint config", os.Remove(endpointConfigPath))+ }}if !opts.KeepLogs {for _, path := range runtimeLogFiles(cfg.LogPath) {diff --git a/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go b/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.goindex 19b2958c..79487bc5 100644--- a/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go+++ b/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go@@ -7,6 +7,7 @@ import ("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/testenv")@@ -115,3 +116,36 @@ func TestInstallWithoutStartingServicesLeavesTheForwarderToTheCaller(t *testing.t.Fatal("a --no-start install reconciled the forwarder")}}++// Repair's teardown keeps config.json, so the reinstall carries the managed_ingest block over+// instead of rewriting the file as if the still-forwarding endpoint were not connected.+func TestRepairTeardownKeepsTheManagedIngestRecord(t *testing.T) {+ for _, withManifest := range []bool{false, true} {+ testenv.SetHome(t, t.TempDir())+ writeConnectedState(t)+ cfg := endpointconfig.Default(true, filepath.Join(t.TempDir(), "runtime.jsonl"))+ cfg.ManagedIngest = &endpointconfig.ManagedIngest{Enabled: true, IngestURL: "https://ingest.example", DeviceID: "d", PrivacyMode: "metadata_only"}+ configPath, err := endpointconfig.Save(cfg)+ if err != nil {+ t.Fatal(err)+ }+ if withManifest {+ if _, err := writeManifest(true, Manifest{Files: []string{configPath}}); err != nil {+ t.Fatal(err)+ }+ }+ if err := Uninstall(repairUninstallOptions(InstallOptions{UserMode: true})); err != nil {+ t.Fatal(err)+ }+ kept, err := endpointconfig.Load(true)+ if err != nil {+ t.Fatalf("manifest=%v: repair's teardown removed config.json: %v", withManifest, err)+ }+ if kept.ManagedIngest == nil || kept.ManagedIngest.PrivacyMode != "metadata_only" {+ t.Fatalf("manifest=%v: managed_ingest = %+v, want it kept", withManifest, kept.ManagedIngest)+ }+ if got := buildConfig(InstallOptions{UserMode: true}); got.ManagedIngest == nil {+ t.Fatalf("manifest=%v: the reinstall's config dropped managed_ingest", withManifest)+ }+ }+}