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 copilot managed detection false positives and factory user config kind
Cursor Agent1d27661b9309
diff --git a/cli/beacon/internal/endpoint/inventory/inventory.go b/cli/beacon/internal/endpoint/inventory/inventory.goindex bf402347..18a97331 100644--- a/cli/beacon/internal/endpoint/inventory/inventory.go+++ b/cli/beacon/internal/endpoint/inventory/inventory.go@@ -224,7 +224,7 @@ func vscodeCandidates(home, wd string) []candidate {func factoryCandidates(home, wd string) []candidate {return []candidate{{runtime: "factory", path: shellProfilePath(home), scope: ScopeUser, format: formatMetadataOnly, kind: KindProfile},- {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},+ {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},{runtime: "factory", path: filepath.Join(wd, ".factory", "settings.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},}}@@ -578,12 +578,48 @@ func beaconManaged(item candidate, data []byte) bool {if item.runtime == "factory" && strings.Contains(text, "OTEL_TELEMETRY_ENDPOINT") && localEndpointText(text) {return true}- if item.runtime == "copilot_cli" && strings.Contains(text, "COPILOT_OTEL_ENABLED") && localEndpointText(text) {+ if item.runtime == "copilot_cli" && copilotOTELEnabled(text) {return true}return false}+func copilotOTELEnabled(text string) bool {+ enabled := shellExportValue(text, "COPILOT_OTEL_ENABLED")+ if !truthyValue(enabled) {+ return false+ }+ endpoint := shellExportValue(text, "COPILOT_OTEL_ENDPOINT")+ if endpoint == "" {+ endpoint = shellExportValue(text, "OTEL_EXPORTER_OTLP_ENDPOINT")+ }+ if endpoint == "" {+ return false+ }+ return localEndpointText(endpoint)+}++func shellExportValue(text, key string) string {+ for _, line := range strings.Split(text, "\n") {+ line = strings.TrimSpace(line)+ if strings.HasPrefix(line, "#") {+ continue+ }+ line = strings.TrimPrefix(line, "export ")+ if !strings.HasPrefix(line, key+"=") {+ continue+ }+ value := strings.TrimSpace(strings.TrimPrefix(line, key+"="))+ return strings.Trim(value, `"'`)+ }+ return ""+}++func truthyValue(value string) bool {+ normalized := strings.ToLower(strings.TrimSpace(value))+ return normalized == "true" || normalized == "1"+}+func localEndpointText(text string) bool {return strings.Contains(text, "127.0.0.1") || strings.Contains(text, "localhost")}diff --git a/cli/beacon/internal/endpoint/inventory/inventory_test.go b/cli/beacon/internal/endpoint/inventory/inventory_test.goindex 93f3376b..3153edfb 100644--- a/cli/beacon/internal/endpoint/inventory/inventory_test.go+++ b/cli/beacon/internal/endpoint/inventory/inventory_test.go@@ -189,7 +189,7 @@ func TestScanIncludesAllSupportedCurrentUserAndProjectConfigs(t *testing.T) {{runtime: "vscode", path: filepath.Join(home, ".copilot", "hooks", "beacon.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},{runtime: "vscode", path: filepath.Join(work, ".github", "hooks", "beacon.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},{runtime: "factory", path: filepath.Join(home, ".bash_profile"), scope: ScopeUser, format: formatMetadataOnly, kind: KindProfile},- {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser, format: formatJSON, kind: KindNativeConfig},+ {runtime: "factory", path: filepath.Join(home, ".factory", "settings.json"), scope: ScopeUser, format: formatJSON, kind: KindHookConfig},{runtime: "factory", path: filepath.Join(work, ".factory", "settings.json"), scope: ScopeProject, format: formatJSON, kind: KindHookConfig},{runtime: "copilot_cli", path: filepath.Join(home, ".bash_profile"), scope: ScopeUser, format: formatMetadataOnly, kind: KindProfile},{runtime: "opencode", path: filepath.Join(home, ".config", "opencode", "plugins", "beacon.ts"), scope: ScopeUser, format: formatMetadataOnly, kind: KindPlugin},@@ -270,6 +270,78 @@ mcpServers:}}+func TestCopilotManagedDetectionFalsePositives(t *testing.T) {+ t.Setenv("SHELL", "/bin/zsh")+ cases := []struct {+ name string+ content string+ want bool+ }{+ {+ name: "commented_out",+ content: "# export COPILOT_OTEL_ENABLED=true\nexport OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\n",+ want: false,+ },+ {+ name: "disabled_false",+ content: "export COPILOT_OTEL_ENABLED=false\nexport OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318\n",+ want: false,+ },+ {+ name: "disabled_zero",+ content: "export COPILOT_OTEL_ENABLED=0\nexport COPILOT_OTEL_ENDPOINT=http://127.0.0.1:4318\n",+ want: false,+ },+ {+ name: "enabled_no_endpoint",+ content: "export COPILOT_OTEL_ENABLED=true\n",+ want: false,+ },+ {+ name: "enabled_remote_endpoint",+ content: "export COPILOT_OTEL_ENABLED=true\nexport COPILOT_OTEL_ENDPOINT=http://remote.example.com:4318\n",+ want: false,+ },+ {+ name: "enabled_with_local_endpoint",+ content: "export COPILOT_OTEL_ENABLED=true\nexport COPILOT_OTEL_ENDPOINT=http://127.0.0.1:4318\n",+ want: true,+ },+ {+ name: "enabled_with_generic_otlp_endpoint",+ content: "export COPILOT_OTEL_ENABLED=1\nexport OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318\n",+ want: true,+ },+ {+ name: "factory_endpoint_only",+ content: "export OTEL_TELEMETRY_ENDPOINT=http://127.0.0.1:4318\n",+ want: false,+ },+ }+ for _, tc := range cases {+ t.Run(tc.name, func(t *testing.T) {+ home := t.TempDir()+ work := t.TempDir()+ writeFile(t, filepath.Join(home, ".zshrc"), tc.content)++ result := Scan(Options{+ ContentRetention: RedactionRedacted,+ HomeDir: home,+ WorkingDir: work,+ Now: fixedNow,+ })++ copilotProfile := findConfig(result.Configs, "copilot_cli", filepath.Join(home, ".zshrc"))+ if copilotProfile == nil {+ t.Fatal("copilot shell profile config not found")+ }+ if copilotProfile.BeaconManaged != tc.want {+ t.Fatalf("copilot BeaconManaged = %t, want %t", copilotProfile.BeaconManaged, tc.want)+ }+ })+ }+}+func fixedNow() time.Time {return time.Date(2026, 6, 5, 7, 0, 0, 0, time.UTC)}