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 only for repair, not uninstall --keep-config
Clauded5e329860074
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex 55398622..abc0b1fb 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -668,12 +668,13 @@ func Uninstall(opts UninstallOptions) error {if !opts.KeepConfig {restoreBackups(manifest.Backups)}- // KeepConfig (repair) keeps config.json so the reinstall carries over what connect,+ // Repair (KeepManagedIngest) 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.+ // a repaired endpoint that kept forwarding read as unconnected on disk. `uninstall+ // --keep-config` keeps harness settings only, so it still removes Beacon's own config.endpointConfigPath := endpointconfig.ConfigPath(cfg.UserMode)for _, path := range manifest.Files {- if opts.KeepConfig && path == endpointConfigPath {+ if opts.KeepManagedIngest && path == endpointConfigPath {continue}fail("remove "+path, os.Remove(path))@@ -683,7 +684,7 @@ func Uninstall(opts UninstallOptions) error {fail("remove "+path, os.Remove(path))}fail("remove "+cfg.Collector.ConfigPath, os.Remove(cfg.Collector.ConfigPath))- if !opts.KeepConfig {+ if !opts.KeepManagedIngest {fail("remove endpoint config", os.Remove(endpointConfigPath))}}diff --git a/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go b/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.goindex 79487bc5..5fcb4704 100644--- a/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go+++ b/cli/beacon/internal/endpoint/lifecycle/managed_forwarder_test.go@@ -149,3 +149,24 @@ func TestRepairTeardownKeepsTheManagedIngestRecord(t *testing.T) {}}}++// `uninstall --keep-config` keeps harness settings, not Beacon's own config.json: only repair keeps it.+func TestUninstallKeepConfigStillRemovesBeaconConfig(t *testing.T) {+ for _, withManifest := range []bool{false, true} {+ testenv.SetHome(t, t.TempDir())+ cfg := endpointconfig.Default(true, filepath.Join(t.TempDir(), "runtime.jsonl"))+ 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)+ }+ }+ _ = Uninstall(UninstallOptions{UserMode: true, KeepConfig: true})+ if _, err := os.Stat(configPath); !os.IsNotExist(err) {+ t.Fatalf("manifest=%v: uninstall --keep-config left %s behind: %v", withManifest, configPath, err)+ }+ }+}