Skip to content

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

Uninstall removes the OTLP forward headers even without a manifest

Claude4bd21278da71
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index 4dea1273..4d026b6b 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -872,6 +872,12 @@ func Uninstall(opts UninstallOptions) error {
fail("remove endpoint config", os.Remove(endpointConfigPath))
}
}
+ // The forward's header values are a credential, so they go with config.json whether or not the
+ // manifest lists them: an install interrupted before writing it, or one whose manifest was lost,
+ // would otherwise leave the backend's token behind.
+ if !opts.KeepManagedIngest {
+ fail("remove the OTLP forward headers", os.Remove(forwardSecretsPath))
+ }
if !opts.KeepLogs {
for _, path := range runtimeLogFiles(cfg.LogPath) {
fail("remove "+path, os.Remove(path))
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
index 00e42f7f..2d4fd7c1 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
@@ -377,7 +377,7 @@ func TestUninstallFallbackRemovesKnownFiles(t *testing.T) {
testenv.SetHome(t, home)
logPath := filepath.Join(home, ".beacon", "endpoint", "logs", "runtime.jsonl")
cfg := endpointconfig.Default(true, logPath)
- for _, path := range []string{endpointconfig.ConfigPath(true), cfg.Collector.ConfigPath, logPath} {
+ for _, path := range []string{endpointconfig.ConfigPath(true), endpointconfig.OTLPForwardSecretsPath(true), cfg.Collector.ConfigPath, logPath} {
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
t.Fatalf("mkdir %s: %v", path, err)
}
@@ -389,7 +389,7 @@ func TestUninstallFallbackRemovesKnownFiles(t *testing.T) {
if err := Uninstall(UninstallOptions{UserMode: true, LogPath: logPath}); err != nil {
t.Fatalf("Uninstall returned error: %v", err)
}
- for _, path := range []string{endpointconfig.ConfigPath(true), cfg.Collector.ConfigPath, logPath} {
+ for _, path := range []string{endpointconfig.ConfigPath(true), endpointconfig.OTLPForwardSecretsPath(true), cfg.Collector.ConfigPath, logPath} {
if _, err := os.Stat(path); !os.IsNotExist(err) {
t.Fatalf("%s still exists or unexpected error: %v", path, err)
}