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 codex telemetry defaults
Justin D'Souza7a727b423f0e
diff --git a/CLAUDE.md b/CLAUDE.mdindex ef289d8b..e2a0125e 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -85,7 +85,7 @@ Run the local dashboard during manual testing:```bashcd cli/beacon-go run . endpoint dashboard --user+go run . endpoint dashboard```## Implementation Notesdiff --git a/README.md b/README.mdindex d5c99271..2f668717 100644--- a/README.md+++ b/README.md@@ -110,24 +110,29 @@ cd cli/beaconmake build```-### Install In User Mode+### Install Locally```bash-beacon endpoint install --user-beacon endpoint status --user+beacon endpoint install+beacon endpoint status```+The normal CLI flow uses per-user endpoint paths by default. Cursor hooks,+Claude Code OTLP, and Codex OTLP all write to the same user runtime log:+`~/.beacon/endpoint/logs/runtime.jsonl`. Use `--system` only for root-managed+package or MDM deployments.+### Set Content Retention```bash-beacon endpoint install --user --content-retention metadata+beacon endpoint install --content-retention metadata```### Configure Wazuh Output```bash-beacon endpoint wazuh print-config --user-beacon endpoint wazuh validate --user+beacon endpoint wazuh print-config+beacon endpoint wazuh validate```### Run The macOS Smoke Test@@ -141,7 +146,7 @@ sh packaging/macos/smoke-endpoint.sh### Cursor Hooks```bash-beacon endpoint hooks install --harness cursor --user+beacon endpoint hooks install --harness cursor```### Claude Cowork@@ -150,15 +155,15 @@ Claude Cowork OpenTelemetry export is configured in the Claude admin console andrequires a Team/Enterprise admin.```bash-beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --user --open-beacon endpoint integrations claude-cowork validate --user --since 10m+beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --open+beacon endpoint integrations claude-cowork validate --since 10m```For local testing only, Beacon can create a temporary authenticated ngrok tunnelto the local OTLP HTTP receiver:```bash-beacon endpoint integrations claude-cowork setup --ngrok --user --open+beacon endpoint integrations claude-cowork setup --ngrok --open```## Claude Cowork Durable Collector@@ -198,12 +203,13 @@ Recommended production shape:Run the local dashboard:```bash-beacon endpoint dashboard --user-beacon endpoint dashboard --user --open+beacon endpoint dashboard+beacon endpoint dashboard --open```The dashboard binds to loopback by default and reads the local runtime JSONL log.-It is intended for local inspection, not remote administration.+It is intended for local inspection, not remote administration. In the default+CLI setup it reads the same user log used by hook and OTLP telemetry.## Command Reference@@ -211,16 +217,16 @@ Common commands:```bashbeacon version-beacon endpoint install --user-beacon endpoint status --user+beacon endpoint install+beacon endpoint statusbeacon endpoint discover-beacon endpoint dashboard --user --open-beacon endpoint wazuh print-config --user-beacon endpoint wazuh validate --user-beacon endpoint hooks install --harness cursor --user-beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --user --open-beacon endpoint integrations claude-cowork validate --user --since 10m-beacon endpoint uninstall --user --keep-logs+beacon endpoint dashboard --open+beacon endpoint wazuh print-config+beacon endpoint wazuh validate+beacon endpoint hooks install --harness cursor+beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --open+beacon endpoint integrations claude-cowork validate --since 10m+beacon endpoint uninstall --keep-logs```- `beacon endpoint install`: configure the endpoint agent, Collector service, and Claude/Codex telemetry.@@ -236,7 +242,7 @@ beacon endpoint uninstall --user --keep-logsUninstall while keeping logs:```bash-beacon endpoint uninstall --user --keep-logs+beacon endpoint uninstall --keep-logs```## Repository Layout@@ -256,25 +262,25 @@ content-retention defaults, log paths, and uninstall behavior.For macOS, publish a signed and notarized package or Homebrew formula thatinstalls the CLI, collector, Wazuh content pack, and deployment scripts. The-package should apply explicit endpoint settings, for example:+package should apply explicit system endpoint settings, for example:```bash-beacon endpoint install --harness claude,codex --content-retention metadata+beacon endpoint install --system --harness claude,codex --content-retention metadata```Before publishing a release, verify the build from a clean checkout and cleanmacOS host or VM:- `beacon version` reports the expected version, commit, and build date.-- `beacon endpoint install --user --no-start` succeeds without developer+- `beacon endpoint install --no-start` succeeds without developertooling.-- `beacon endpoint status --user` reports config, collector, service, harness,+- `beacon endpoint status` reports config, collector, service, harness,diagnostic, and runtime log paths.-- `beacon endpoint wazuh validate --user` writes a valid Beacon JSONL event.-- `beacon endpoint dashboard --user` starts on `127.0.0.1`, serves a read-only+- `beacon endpoint wazuh validate` writes a valid Beacon JSONL event.+- `beacon endpoint dashboard` starts on `127.0.0.1`, serves a read-onlydashboard, and can search local telemetry without external networkdependencies.-- `beacon endpoint uninstall --user` removes managed service and config files.+- `beacon endpoint uninstall` removes managed service and config files.- macOS package signature and notarization are valid when distributing a `.pkg`.The repository smoke test keeps this flow local and non-root:diff --git a/cli/beacon/.goreleaser.yaml b/cli/beacon/.goreleaser.yamlindex 86fa0dbe..4282d4e6 100644--- a/cli/beacon/.goreleaser.yaml+++ b/cli/beacon/.goreleaser.yaml@@ -85,7 +85,7 @@ brews:bin.install "beacon"caveats: |To configure local endpoint telemetry, run:- beacon endpoint install --user+ beacon endpoint installtest: |system "#{bin}/beacon", "version"@@ -110,7 +110,7 @@ release:## Quick Start```bash- beacon endpoint install --user+ beacon endpoint installbeacon endpoint statusbeacon endpoint wazuh print-config```diff --git a/cli/beacon/README.md b/cli/beacon/README.mdindex 77be5aa0..ab063bab 100644--- a/cli/beacon/README.md+++ b/cli/beacon/README.md@@ -11,20 +11,24 @@ make build## Common Commands```bash-./beacon endpoint install --user+./beacon endpoint install./beacon endpoint status --json./beacon endpoint discover --json-./beacon endpoint repair --user-./beacon endpoint dashboard --user-./beacon endpoint uninstall --user --keep-logs+./beacon endpoint repair+./beacon endpoint dashboard+./beacon endpoint uninstall --keep-logs```+Endpoint commands use per-user paths by default so hook and OTLP telemetry share+`~/.beacon/endpoint/logs/runtime.jsonl`. Use `--system` for root-managed+deployment paths.+## Dashboard```bash-./beacon endpoint dashboard --user-./beacon endpoint dashboard --user --addr 127.0.0.1:8765-./beacon endpoint dashboard --user --open+./beacon endpoint dashboard+./beacon endpoint dashboard --addr 127.0.0.1:8765+./beacon endpoint dashboard --open```The dashboard reads the configured runtime JSONL log and serves a local,@@ -39,20 +43,20 @@ that may need review.## Wazuh```bash-./beacon endpoint wazuh print-config --user-./beacon endpoint wazuh install-pack --output ./beacon-wazuh --user-./beacon endpoint wazuh validate --user+./beacon endpoint wazuh print-config+./beacon endpoint wazuh install-pack --output ./beacon-wazuh+./beacon endpoint wazuh validate```## Optional Integrations```bash-./beacon endpoint hooks install --harness cursor --user-./beacon endpoint hooks status --harness cursor --user+./beacon endpoint hooks install --harness cursor+./beacon endpoint hooks status --harness cursor-./beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --user --open-./beacon endpoint integrations claude-cowork setup --ngrok --user --open-./beacon endpoint integrations claude-cowork validate --user --since 10m+./beacon endpoint integrations claude-cowork setup --endpoint https://collector.example.com --open+./beacon endpoint integrations claude-cowork setup --ngrok --open+./beacon endpoint integrations claude-cowork validate --since 10m```Claude Cowork monitoring is configured in the Claude admin console atdiff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.goindex ae2e2c57..fd71ce31 100644--- a/cli/beacon/cmd/endpoint.go+++ b/cli/beacon/cmd/endpoint.go@@ -22,6 +22,7 @@ import (var endpointOpts struct {userMode bool+ systemMode boollogPath stringharnesses stringhookHarnesses string@@ -246,7 +247,8 @@ func init() {endpointCoworkCmd.AddCommand(endpointCoworkValidateCmd)for _, c := range []*cobra.Command{endpointInstallCmd, endpointStatusCmd, endpointDiscoverCmd, endpointUninstallCmd, endpointRepairCmd} {- c.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ c.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ c.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")c.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")}@@ -261,22 +263,27 @@ func init() {endpointRepairCmd.Flags().IntVar(&endpointOpts.httpPort, "otlp-http-port", endpointconfig.DefaultHTTPPort, "Local OTLP HTTP port")endpointRepairCmd.Flags().StringVar(&endpointOpts.collectorPath, "collector", "", "Path to a beacon-otelcol binary")endpointRepairCmd.Flags().StringVar(&endpointOpts.contentRetention, "content-retention", "metadata", "Content retention mode: metadata, redacted, or full")- endpointDashboardCmd.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ endpointDashboardCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ endpointDashboardCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")endpointDashboardCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")endpointDashboardCmd.Flags().StringVar(&endpointOpts.dashboardAddr, "addr", dashboard.DefaultAddr, "Local dashboard listen address")endpointDashboardCmd.Flags().BoolVar(&endpointOpts.dashboardOpen, "open", false, "Open the dashboard in a browser")endpointDiscoverCmd.Flags().BoolVar(&endpointOpts.jsonOutput, "json", false, "Print discovery as JSON")endpointStatusCmd.Flags().BoolVar(&endpointOpts.jsonOutput, "json", false, "Print status as JSON")- endpointWazuhPrintConfigCmd.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ endpointWazuhPrintConfigCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ endpointWazuhPrintConfigCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")endpointWazuhPrintConfigCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")endpointWazuhInstallPackCmd.Flags().StringVar(&endpointOpts.outputDir, "output", "", "Output directory for Wazuh content pack")- endpointWazuhInstallPackCmd.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ endpointWazuhInstallPackCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ endpointWazuhInstallPackCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")endpointWazuhInstallPackCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")- endpointWazuhValidateCmd.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ endpointWazuhValidateCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ endpointWazuhValidateCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")endpointWazuhValidateCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")for _, c := range []*cobra.Command{endpointCoworkPrintConfigCmd, endpointCoworkSetupCmd, endpointCoworkStatusCmd, endpointCoworkValidateCmd} {- c.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ c.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ c.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")c.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")}endpointCoworkPrintConfigCmd.Flags().StringVar(&endpointOpts.coworkHeaders, "headers", "", "Optional OTLP headers to show in setup guidance")@@ -293,7 +300,8 @@ func init() {endpointCoworkValidateCmd.Flags().StringVar(&endpointOpts.coworkSince, "since", "", "Require a Claude Cowork event within this duration, such as 10m")endpointCoworkStatusCmd.Flags().BoolVar(&endpointOpts.jsonOutput, "json", false, "Print status as JSON")for _, c := range []*cobra.Command{endpointHooksInstallCmd, endpointHooksUninstallCmd, endpointHooksStatusCmd} {- c.Flags().BoolVar(&endpointOpts.userMode, "user", false, "Use per-user endpoint paths instead of system paths")+ c.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")+ c.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")c.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")c.Flags().StringVar(&endpointOpts.hookHarnesses, "harness", "cursor", "Comma-separated hook harnesses")c.Flags().StringVar(&endpointOpts.hookLevel, "level", "user", "Hook install level: user or project")@@ -378,6 +386,10 @@ func runEndpointWazuhValidate(cmd *cobra.Command, args []string) error {func runEndpointDashboard(cmd *cobra.Command, args []string) error {cfg := loadOrDefaultConfig()+ userMode := endpointUserMode()+ runtimeLog := lifecycle.ResolveRuntimeLog(userMode, endpointOpts.logPath)+ cfg.UserMode = runtimeLog.EffectiveUserMode+ cfg.LogPath = runtimeLog.EffectiveLogPathif endpointOpts.dashboardAddr == "" {endpointOpts.dashboardAddr = dashboard.DefaultAddr}@@ -387,6 +399,9 @@ func runEndpointDashboard(cmd *cobra.Command, args []string) error {url := dashboard.URL(endpointOpts.dashboardAddr)fmt.Printf("Beacon endpoint dashboard: %s\n", url)fmt.Printf("Runtime log: %s\n", cfg.LogPath)+ if runtimeLog.Warning != "" {+ fmt.Printf("Runtime log source: %s\n", runtimeLog.Warning)+ }if endpointOpts.dashboardOpen {if err := dashboard.OpenBrowser(url); err != nil {return err@@ -401,7 +416,7 @@ func runEndpointDashboard(cmd *cobra.Command, args []string) error {func runEndpointInstall(cmd *cobra.Command, args []string) error {result, err := lifecycle.Install(lifecycle.InstallOptions{- UserMode: endpointOpts.userMode,+ UserMode: endpointUserMode(),LogPath: endpointOpts.logPath,Harnesses: splitCSV(endpointOpts.harnesses),GRPCPort: endpointOpts.grpcPort,@@ -422,13 +437,16 @@ func runEndpointInstall(cmd *cobra.Command, args []string) error {}func runEndpointStatus(cmd *cobra.Command, args []string) error {- status := lifecycle.GetStatus(endpointOpts.userMode, endpointOpts.logPath)+ status := lifecycle.GetStatus(endpointUserMode(), endpointOpts.logPath)if endpointOpts.jsonOutput {return json.NewEncoder(os.Stdout).Encode(status)}fmt.Printf("Beacon Endpoint Agent %s\n", status.Version)fmt.Printf("Config: %s\n", status.ConfigPath)fmt.Printf("Runtime log: %s\n", status.LogPath)+ if status.RuntimeLog.Warning != "" {+ fmt.Printf("Runtime log source: %s\n", status.RuntimeLog.Warning)+ }fmt.Printf("Collector: grpc=%t http=%t", status.Collector.GRPCReady, status.Collector.HTTPReady)if status.Collector.Message != "" {fmt.Printf(" (%s)", status.Collector.Message)@@ -509,7 +527,7 @@ func writeValidationEvent(cfg endpointconfig.Config, destination string) (string}func runEndpointUninstall(cmd *cobra.Command, args []string) error {- if err := lifecycle.Uninstall(lifecycle.UninstallOptions{UserMode: endpointOpts.userMode, LogPath: endpointOpts.logPath, KeepLogs: endpointOpts.keepLogs, KeepConfig: endpointOpts.keepConfig}); err != nil {+ if err := lifecycle.Uninstall(lifecycle.UninstallOptions{UserMode: endpointUserMode(), LogPath: endpointOpts.logPath, KeepLogs: endpointOpts.keepLogs, KeepConfig: endpointOpts.keepConfig}); err != nil {return err}fmt.Println("Endpoint service, config, and managed files removed.")@@ -518,7 +536,7 @@ func runEndpointUninstall(cmd *cobra.Command, args []string) error {func runEndpointRepair(cmd *cobra.Command, args []string) error {result, err := lifecycle.Repair(lifecycle.InstallOptions{- UserMode: endpointOpts.userMode,+ UserMode: endpointUserMode(),LogPath: endpointOpts.logPath,Harnesses: splitCSV(endpointOpts.harnesses),GRPCPort: endpointOpts.grpcPort,@@ -535,7 +553,8 @@ func runEndpointRepair(cmd *cobra.Command, args []string) error {}func loadOrDefaultConfig() endpointconfig.Config {- if cfg, err := endpointconfig.Load(endpointOpts.userMode); err == nil {+ userMode := endpointUserMode()+ if cfg, err := endpointconfig.Load(userMode); err == nil {if endpointOpts.logPath != "" {cfg.LogPath = endpointOpts.logPath}@@ -543,9 +562,13 @@ func loadOrDefaultConfig() endpointconfig.Config {}logPath := endpointOpts.logPathif logPath == "" {- logPath = writer.DefaultPath(endpointOpts.userMode)+ logPath = writer.DefaultPath(userMode)}- return endpointconfig.Default(endpointOpts.userMode, logPath)+ return endpointconfig.Default(userMode, logPath)+}++func endpointUserMode() bool {+ return endpointOpts.userMode && !endpointOpts.systemMode}func splitCSV(value string) []string {diff --git a/cli/beacon/cmd/endpoint_cowork.go b/cli/beacon/cmd/endpoint_cowork.goindex 18ecf656..da98ee18 100644--- a/cli/beacon/cmd/endpoint_cowork.go+++ b/cli/beacon/cmd/endpoint_cowork.go@@ -146,7 +146,7 @@ func displayValue(value string) string {func requireLocalOTLPHTTP(port int) error {conn, err := net.DialTimeout("tcp", fmt.Sprintf("127.0.0.1:%d", port), time.Second)if err != nil {- return fmt.Errorf("local OTLP HTTP receiver is not listening on 127.0.0.1:%d; run `beacon endpoint install --user` or `beacon endpoint repair --user` first", port)+ return fmt.Errorf("local OTLP HTTP receiver is not listening on 127.0.0.1:%d; run `beacon endpoint install` or `beacon endpoint repair` first", port)}_ = conn.Close()return nildiff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.goindex 42de9c02..13cd9a7d 100644--- a/cli/beacon/cmd/endpoint_test.go+++ b/cli/beacon/cmd/endpoint_test.go@@ -1,6 +1,10 @@package cmd-import "testing"+import (+ "testing"++ "github.com/spf13/cobra"+)func TestSplitCSV(t *testing.T) {got := splitCSV("cursor, claude-cowork,,codex")@@ -87,3 +91,18 @@ func TestEndpointHarnessDefaultsDoNotClobberInstall(t *testing.T) {t.Fatalf("hooks install --harness default = %q, want %q", got, want)}}++func TestEndpointCommandsDefaultToUserMode(t *testing.T) {+ for _, cmd := range []*cobra.Command{endpointInstallCmd, endpointStatusCmd, endpointDashboardCmd, endpointHooksInstallCmd} {+ userFlag := cmd.Flags().Lookup("user")+ if userFlag == nil {+ t.Fatalf("%s missing --user flag", cmd.Use)+ }+ if userFlag.DefValue != "true" {+ t.Fatalf("%s --user default = %q, want true", cmd.Use, userFlag.DefValue)+ }+ if cmd.Flags().Lookup("system") == nil {+ t.Fatalf("%s missing --system flag", cmd.Use)+ }+ }+}diff --git a/cli/beacon/cmd/root.go b/cli/beacon/cmd/root.goindex 22152dd3..d3f650ac 100644--- a/cli/beacon/cmd/root.go+++ b/cli/beacon/cmd/root.go@@ -20,7 +20,7 @@ Beacon-hosted backend.`,fmt.Println("Beacon Endpoint Agent")fmt.Println()fmt.Println("Start with:")- fmt.Println(" beacon endpoint install --user")+ fmt.Println(" beacon endpoint install")fmt.Println(" beacon endpoint status")fmt.Println(" beacon endpoint wazuh print-config")fmt.Println()diff --git a/cli/beacon/internal/endpoint/dashboard/events.go b/cli/beacon/internal/endpoint/dashboard/events.goindex adc0744c..a8d9d5c6 100644--- a/cli/beacon/internal/endpoint/dashboard/events.go+++ b/cli/beacon/internal/endpoint/dashboard/events.go@@ -86,6 +86,9 @@ func ReadEvents(path string, query EventQuery) (EventResult, error) {result.MalformedLines++continue}+ if event.Event.Category == "" {+ event.Event.Category = inferEventCategory(event.Event.Action)+ }parsed, _ := time.Parse(time.RFC3339, event.Timestamp)record := EventRecord{ID: fmt.Sprintf("line-%d", lineNo),@@ -147,6 +150,9 @@ func FindEvent(path, id string) (EventRecord, bool, error) {if err := json.Unmarshal(line, &event); err != nil {return EventRecord{}, false, nil}+ if event.Event.Category == "" {+ event.Event.Category = inferEventCategory(event.Event.Action)+ }parsed, _ := time.Parse(time.RFC3339, event.Timestamp)return EventRecord{ID: id,@@ -264,6 +270,27 @@ func matchesCommand(event schema.Event, command string) bool {return false}+func inferEventCategory(action string) string {+ switch {+ case strings.HasPrefix(action, "prompt."):+ return "prompt"+ case strings.HasPrefix(action, "command."):+ return "command"+ case strings.HasPrefix(action, "file."):+ return "file"+ case strings.HasPrefix(action, "mcp."):+ return "mcp"+ case strings.HasPrefix(action, "approval.") || strings.HasPrefix(action, "policy."):+ return "approval"+ case strings.HasPrefix(action, "metric."):+ return "metric"+ case strings.HasPrefix(action, "tool."):+ return "tool"+ default:+ return ""+ }+}+func matchesFreeText(record EventRecord, query string) bool {haystack := strings.ToLower(strings.Join(searchFields(record), "\x00"))for _, term := range strings.Fields(strings.ToLower(strings.TrimSpace(query))) {diff --git a/cli/beacon/internal/endpoint/dashboard/events_test.go b/cli/beacon/internal/endpoint/dashboard/events_test.goindex 1be73c4c..aa7e5eca 100644--- a/cli/beacon/internal/endpoint/dashboard/events_test.go+++ b/cli/beacon/internal/endpoint/dashboard/events_test.go@@ -34,6 +34,23 @@ func TestReadEventsSkipsMalformedLinesAndFilters(t *testing.T) {}}+func TestReadEventsInfersMissingCategory(t *testing.T) {+ path := filepath.Join(t.TempDir(), "runtime.jsonl")+ event := testSchemaEvent("2026-05-13T01:00:00Z", "codex_cli", "tool.invoked", "", "repo-a")+ writeTestLog(t, path, marshalEvents(t, event)...)++ result, err := ReadEvents(path, EventQuery{Limit: 10})+ if err != nil {+ t.Fatalf("ReadEvents returned error: %v", err)+ }+ if len(result.Events) != 1 {+ t.Fatalf("events length = %d, want 1", len(result.Events))+ }+ if got := result.Events[0].Event.Event.Category; got != "tool" {+ t.Fatalf("Category = %q, want tool", got)+ }+}+func TestBuildSummaryAggregatesSignals(t *testing.T) {result := EventResult{TotalMatched: 4,diff --git a/cli/beacon/internal/endpoint/dashboard/server.go b/cli/beacon/internal/endpoint/dashboard/server.goindex c39fed28..c8e7cf14 100644--- a/cli/beacon/internal/endpoint/dashboard/server.go+++ b/cli/beacon/internal/endpoint/dashboard/server.go@@ -15,7 +15,6 @@ import (endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/lifecycle"- "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/writer")const DefaultAddr = "127.0.0.1:8765"@@ -33,6 +32,7 @@ type StatusResponse struct {Version string `json:"version"`ConfigPath string `json:"config_path"`LogPath string `json:"log_path"`+ RuntimeLog lifecycle.RuntimeLogSource `json:"runtime_log"`ContentRetention endpointconfig.ContentRetention `json:"content_retention"`Harnesses interface{} `json:"harnesses"`Collector interface{} `json:"collector"`@@ -41,9 +41,9 @@ type StatusResponse struct {}func Handler(opts Options) (http.Handler, error) {- if opts.LogPath == "" {- opts.LogPath = writer.DefaultPath(opts.UserMode)- }+ runtimeLog := lifecycle.ResolveRuntimeLog(opts.UserMode, opts.LogPath)+ opts.LogPath = runtimeLog.EffectiveLogPath+ opts.UserMode = runtimeLog.EffectiveUserModestaticRoot, err := fs.Sub(staticFiles, "static")if err != nil {return nil, err@@ -66,6 +66,7 @@ func Handler(opts Options) (http.Handler, error) {Version: status.Version,ConfigPath: status.ConfigPath,LogPath: status.LogPath,+ RuntimeLog: runtimeLog,ContentRetention: cfg.ContentRetention,Harnesses: status.Harnesses,Collector: status.Collector,diff --git a/cli/beacon/internal/endpoint/dashboard/server_test.go b/cli/beacon/internal/endpoint/dashboard/server_test.gonew file mode 100644index 00000000..bd469cfc--- /dev/null+++ b/cli/beacon/internal/endpoint/dashboard/server_test.go@@ -0,0 +1,35 @@+package dashboard++import (+ "encoding/json"+ "net/http"+ "net/http/httptest"+ "path/filepath"+ "testing"+)++func TestStatusUsesExplicitRuntimeLogPath(t *testing.T) {+ logPath := filepath.Join(t.TempDir(), "runtime.jsonl")+ handler, err := Handler(Options{UserMode: true, LogPath: logPath})+ if err != nil {+ t.Fatalf("Handler returned error: %v", err)+ }++ req := httptest.NewRequest(http.MethodGet, "/api/status", nil)+ rec := httptest.NewRecorder()+ handler.ServeHTTP(rec, req)+ if rec.Code != http.StatusOK {+ t.Fatalf("status code = %d, body = %s", rec.Code, rec.Body.String())+ }++ var status StatusResponse+ if err := json.Unmarshal(rec.Body.Bytes(), &status); err != nil {+ t.Fatalf("unmarshal status response: %v", err)+ }+ if status.LogPath != logPath {+ t.Fatalf("LogPath = %q, want %q", status.LogPath, logPath)+ }+ if status.RuntimeLog.EffectiveLogPath != logPath {+ t.Fatalf("RuntimeLog.EffectiveLogPath = %q, want %q", status.RuntimeLog.EffectiveLogPath, logPath)+ }+}diff --git a/cli/beacon/internal/endpoint/harness/harness.go b/cli/beacon/internal/endpoint/harness/harness.goindex 979cdb08..4f9023d8 100644--- a/cli/beacon/internal/endpoint/harness/harness.go+++ b/cli/beacon/internal/endpoint/harness/harness.go@@ -225,11 +225,12 @@ func mergeCodexOTEL(existing, endpoint string) string {for _, line := range lines {trim := strings.TrimSpace(line)if strings.HasPrefix(trim, "[") && strings.HasSuffix(trim, "]") {- if inOTEL && !wroteOTEL {+ isOTELHeader := codexOTELHeader(trim)+ if inOTEL && !isOTELHeader && !wroteOTEL {out = append(out, codexOTELBlock(endpoint)...)wroteOTEL = true}- inOTEL = trim == "[otel]"+ inOTEL = isOTELHeaderif !inOTEL {out = append(out, line)}@@ -253,13 +254,24 @@ func mergeCodexOTEL(existing, endpoint string) string {return strings.TrimRight(strings.Join(out, "\n"), "\n") + "\n"}+func codexOTELHeader(header string) bool {+ return header == "[otel]" || strings.HasPrefix(header, "[otel.")+}+func codexOTELBlock(endpoint string) []string {return []string{"[otel]",- "enabled = true",+ "environment = \"dev\"",+ "log_user_prompt = false",+ "",+ "[otel.exporter.\"otlp-grpc\"]",+ fmt.Sprintf("endpoint = %q", endpoint),+ "",+ "[otel.trace_exporter.\"otlp-grpc\"]",+ fmt.Sprintf("endpoint = %q", endpoint),+ "",+ "[otel.metrics_exporter.\"otlp-grpc\"]",fmt.Sprintf("endpoint = %q", endpoint),- "service_name = \"codex-cli\"",- "sampling_ratio = 1.0",}}@@ -295,8 +307,8 @@ func codexStatus(path string) (TelemetryStatus, string) {if !strings.Contains(text, "[otel]") {return TelemetryDisabled, "Codex [otel] config is missing"}- if !strings.Contains(text, "enabled = true") {- return TelemetryDisabled, "Codex OTEL is not enabled"+ if !strings.Contains(text, "otlp-grpc") && !strings.Contains(text, "otlp-http") {+ return TelemetryDisabled, "Codex OTEL exporter is not configured"}if !strings.Contains(text, "127.0.0.1") && !strings.Contains(text, "localhost") {return TelemetryMisconfigured, "Codex OTLP endpoint does not point to localhost"diff --git a/cli/beacon/internal/endpoint/harness/harness_test.go b/cli/beacon/internal/endpoint/harness/harness_test.goindex a196114b..c846c7d1 100644--- a/cli/beacon/internal/endpoint/harness/harness_test.go+++ b/cli/beacon/internal/endpoint/harness/harness_test.go@@ -13,7 +13,8 @@ func TestMergeCodexOTELAddsBlock(t *testing.T) {if !strings.Contains(got, "[otel]") {t.Fatalf("expected otel block: %s", got)}- if !strings.Contains(got, "endpoint = \"http://127.0.0.1:4317\"") {+ if !strings.Contains(got, `[otel.exporter."otlp-grpc"]`) ||+ !strings.Contains(got, `endpoint = "http://127.0.0.1:4317"`) {t.Fatalf("expected endpoint: %s", got)}if !strings.Contains(got, "model = \"gpt-5\"") {@@ -22,9 +23,9 @@ func TestMergeCodexOTELAddsBlock(t *testing.T) {}func TestMergeCodexOTELReplacesExistingBlock(t *testing.T) {- input := "[otel]\nenabled = false\nendpoint = \"https://example.com\"\n\n[profile]\nname = \"default\"\n"+ input := "[otel]\nenabled = false\nendpoint = \"https://example.com\"\n\n[otel.exporter.\"otlp-http\"]\nendpoint = \"https://old.example.com/v1/logs\"\n\n[profile]\nname = \"default\"\n"got := mergeCodexOTEL(input, "http://127.0.0.1:4317")- if strings.Contains(got, "https://example.com") || strings.Contains(got, "enabled = false") {+ if strings.Contains(got, "https://example.com") || strings.Contains(got, "old.example.com") || strings.Contains(got, "enabled = false") {t.Fatalf("old otel config was not replaced: %s", got)}if !strings.Contains(got, "[profile]\nname = \"default\"") {@@ -135,9 +136,12 @@ func TestConfigureCodexWritesTelemetryBlockAndBackup(t *testing.T) {for _, want := range []string{"model = \"gpt-5\"","[otel]",- "enabled = true",+ "environment = \"dev\"",+ "log_user_prompt = false",+ "[otel.exporter.\"otlp-grpc\"]",+ "[otel.trace_exporter.\"otlp-grpc\"]",+ "[otel.metrics_exporter.\"otlp-grpc\"]","endpoint = \"http://127.0.0.1:4317\"",- "service_name = \"codex-cli\"",} {if !strings.Contains(text, want) {t.Fatalf("codex config missing %q:\n%s", want, text)@@ -160,9 +164,12 @@ func TestCodexStatusVariants(t *testing.T) {status TelemetryStatus}{{name: "missing block", body: `model = "gpt-5"`, status: TelemetryDisabled},- {name: "disabled", body: "[otel]\nenabled = false\nendpoint = \"http://127.0.0.1:4317\"\n", status: TelemetryDisabled},- {name: "remote endpoint", body: "[otel]\nenabled = true\nendpoint = \"https://example.com\"\n", status: TelemetryMisconfigured},- {name: "enabled", body: "[otel]\nenabled = true\nendpoint = \"http://localhost:4317\"\n", status: TelemetryEnabled},+ {name: "old shape", body: "[otel]\nenabled = true\nendpoint = \"http://127.0.0.1:4317\"\n", status: TelemetryDisabled},+ {name: "exporter none", body: "[otel]\nexporter = \"none\"\n", status: TelemetryDisabled},+ {name: "remote endpoint", body: "[otel]\nexporter = { otlp-grpc = { endpoint = \"https://example.com:4317\" } }\n", status: TelemetryMisconfigured},+ {name: "grpc enabled", body: "[otel]\nexporter = { otlp-grpc = { endpoint = \"http://localhost:4317\" } }\n", status: TelemetryEnabled},+ {name: "grpc table enabled", body: "[otel]\nlog_user_prompt = false\n\n[otel.exporter.\"otlp-grpc\"]\nendpoint = \"http://localhost:4317\"\n", status: TelemetryEnabled},+ {name: "http enabled", body: "[otel]\nexporter = { otlp-http = { endpoint = \"http://127.0.0.1:4318/v1/logs\" } }\n", status: TelemetryEnabled},}for _, tt := range tests {diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.goindex 9d7acac6..45c07a92 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go@@ -49,6 +49,7 @@ type Status struct {Version string `json:"version"`ConfigPath string `json:"config_path"`LogPath string `json:"log_path"`+ RuntimeLog RuntimeLogSource `json:"runtime_log"`Collector endpointcollector.Status `json:"collector"`Service service.Status `json:"service"`Harnesses []harness.Harness `json:"harnesses"`@@ -56,6 +57,15 @@ type Status struct {LastEvent string `json:"last_event,omitempty"`}+type RuntimeLogSource struct {+ RequestedUserMode bool `json:"requested_user_mode"`+ EffectiveUserMode bool `json:"effective_user_mode"`+ RequestedLogPath string `json:"requested_log_path"`+ EffectiveLogPath string `json:"effective_log_path"`+ Reason string `json:"reason,omitempty"`+ Warning string `json:"warning,omitempty"`+}+type Manifest struct {CreatedAt string `json:"created_at"`UserMode bool `json:"user_mode"`@@ -174,19 +184,71 @@ func Repair(opts InstallOptions) (InstallResult, error) {func GetStatus(userMode bool, logPath string) Status {cfg := loadOrDefault(userMode, logPath)- last, _ := writer.LastLine(cfg.LogPath)+ runtimeLog := ResolveRuntimeLog(userMode, logPath)+ effectiveCfg := cfg+ effectiveCfg.UserMode = runtimeLog.EffectiveUserMode+ if runtimeLog.EffectiveUserMode != cfg.UserMode {+ effectiveCfg = loadOrDefault(runtimeLog.EffectiveUserMode, runtimeLog.EffectiveLogPath)+ }+ effectiveCfg.LogPath = runtimeLog.EffectiveLogPath+ last, _ := writer.LastLine(effectiveCfg.LogPath)+ checks := diagnostics.Run(effectiveCfg)+ if runtimeLog.Warning != "" {+ checks = append(checks, diagnostics.Check{+ Name: "runtime_log_source",+ Status: "warn",+ Severity: "medium",+ Message: runtimeLog.Warning,+ })+ }return Status{Version: version.GetVersion(),- ConfigPath: endpointconfig.ConfigPath(cfg.UserMode),- LogPath: cfg.LogPath,- Collector: endpointcollector.CheckStatus(cfg),- Service: service.Manager{UserMode: cfg.UserMode}.Status(),+ ConfigPath: endpointconfig.ConfigPath(effectiveCfg.UserMode),+ LogPath: effectiveCfg.LogPath,+ RuntimeLog: runtimeLog,+ Collector: endpointcollector.CheckStatus(effectiveCfg),+ Service: service.Manager{UserMode: effectiveCfg.UserMode}.Status(),Harnesses: harness.DiscoverAll(),- Diagnostics: diagnostics.Run(cfg),+ Diagnostics: checks,LastEvent: last,}}+func ResolveRuntimeLog(userMode bool, logPath string) RuntimeLogSource {+ cfg := loadOrDefault(userMode, logPath)+ source := RuntimeLogSource{+ RequestedUserMode: userMode,+ EffectiveUserMode: userMode,+ RequestedLogPath: cfg.LogPath,+ EffectiveLogPath: cfg.LogPath,+ Reason: "requested endpoint configuration",+ }+ if logPath != "" {+ source.Reason = "explicit runtime log path"+ return source+ }+ if !userMode {+ return source+ }+ systemCfg, err := endpointconfig.Load(false)+ if err != nil || !sameCollectorPorts(cfg, systemCfg) || systemCfg.LogPath == "" || systemCfg.LogPath == cfg.LogPath {+ return source+ }+ return selectRuntimeLog(source, service.Manager{UserMode: true}.Status(), service.Manager{UserMode: false}.Status(), systemCfg)+}++func selectRuntimeLog(source RuntimeLogSource, requestedService, systemService service.Status, systemCfg endpointconfig.Config) RuntimeLogSource {+ if systemService.Running && !requestedService.Running {+ source.Reason = "requested endpoint configuration; system collector is also running on the configured OTLP ports"+ source.Warning = fmt.Sprintf("system collector is writing OTLP events to %s instead of the user runtime log %s; stop the system collector or install user mode to keep all events in one file", systemCfg.LogPath, source.RequestedLogPath)+ }+ return source+}++func sameCollectorPorts(left, right endpointconfig.Config) bool {+ return left.Collector.GRPCPort == right.Collector.GRPCPort && left.Collector.HTTPPort == right.Collector.HTTPPort+}+func buildConfig(opts InstallOptions) endpointconfig.Config {logPath := opts.LogPathif logPath == "" {@@ -230,7 +292,7 @@ func preflight(cfg endpointconfig.Config, startService bool) error {return fmt.Errorf("production endpoint install is currently supported only on macOS")}if !cfg.UserMode && os.Geteuid() != 0 {- return fmt.Errorf("system install requires root; rerun with sudo or use --user")+ return fmt.Errorf("system install requires root; rerun with sudo or omit --system for the default user install")}if !startService {return nildiff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.goindex a8a441d7..d2bf50c3 100644--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go@@ -9,6 +9,7 @@ import ("testing"endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"+ "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/service")func TestRestoreTargetTimestampedBackup(t *testing.T) {@@ -56,6 +57,64 @@ func TestBuildConfigAppliesInstallOptions(t *testing.T) {}}+func TestSelectRuntimeLogWarnsWhenSystemCollectorConflictsWithUserMode(t *testing.T) {+ userLog := filepath.Join(t.TempDir(), "user-runtime.jsonl")+ systemLog := filepath.Join(t.TempDir(), "system-runtime.jsonl")+ source := RuntimeLogSource{+ RequestedUserMode: true,+ EffectiveUserMode: true,+ RequestedLogPath: userLog,+ EffectiveLogPath: userLog,+ }+ systemCfg := endpointconfig.Config{LogPath: systemLog}++ got := selectRuntimeLog(+ source,+ service.Status{Label: service.UserLabel, Loaded: false, Running: false},+ service.Status{Label: service.SystemLabel, Loaded: true, Running: true},+ systemCfg,+ )++ if !got.EffectiveUserMode {+ t.Fatal("expected effective user mode")+ }+ if got.EffectiveLogPath != userLog {+ t.Fatalf("EffectiveLogPath = %q, want %q", got.EffectiveLogPath, userLog)+ }+ if got.Warning == "" || !strings.Contains(got.Warning, userLog) || !strings.Contains(got.Warning, systemLog) {+ t.Fatalf("Warning = %q, want user/system log paths", got.Warning)+ }+}++func TestSelectRuntimeLogKeepsUserLogWhenUserCollectorIsRunning(t *testing.T) {+ userLog := filepath.Join(t.TempDir(), "user-runtime.jsonl")+ systemLog := filepath.Join(t.TempDir(), "system-runtime.jsonl")+ source := RuntimeLogSource{+ RequestedUserMode: true,+ EffectiveUserMode: true,+ RequestedLogPath: userLog,+ EffectiveLogPath: userLog,+ }+ systemCfg := endpointconfig.Config{LogPath: systemLog}++ got := selectRuntimeLog(+ source,+ service.Status{Label: service.UserLabel, Loaded: true, Running: true},+ service.Status{Label: service.SystemLabel, Loaded: true, Running: true},+ systemCfg,+ )++ if !got.EffectiveUserMode {+ t.Fatal("expected effective user mode")+ }+ if got.EffectiveLogPath != userLog {+ t.Fatalf("EffectiveLogPath = %q, want %q", got.EffectiveLogPath, userLog)+ }+ if got.Warning != "" {+ t.Fatalf("Warning = %q, want empty", got.Warning)+ }+}+func TestConfigureHarnessesRejectsUnsupportedHarness(t *testing.T) {cfg := endpointconfig.Config{Harnesses: []string{"unknown"}}if _, err := configureHarnesses(cfg); err == nil || !strings.Contains(err.Error(), "unsupported harness") {diff --git a/collector-builder/exporter/beaconjsonexporter/exporter.go b/collector-builder/exporter/beaconjsonexporter/exporter.goindex a16335de..5a15a98e 100644--- a/collector-builder/exporter/beaconjsonexporter/exporter.go+++ b/collector-builder/exporter/beaconjsonexporter/exporter.go@@ -80,6 +80,9 @@ func (e *beaconExporter) consumeTraces(ctx context.Context, traces ptrace.TracesscopeSpans := resourceSpans.ScopeSpans().At(j)for k := 0; k < scopeSpans.Spans().Len(); k++ {span := scopeSpans.Spans().At(k)+ if shouldDropSpan(resourceAttrs, span) {+ continue+ }event := e.eventFromSpan(resourceAttrs, span)if err := e.writer.append(event); err != nil && firstErr == nil {firstErr = err@@ -118,7 +121,7 @@ func (e *beaconExporter) eventFromLog(resourceAttrs map[string]interface{}, recoaction = inferAction(attrs, record.Body().AsString())}message := firstNonEmpty(record.Body().AsString(), firstString(attrs, "message", "log.message"))- event := newBeaconEvent(action, firstString(attrs, "beacon.event.category", "event.category", "category"), severity(record.SeverityText(), record.SeverityNumber().String()), harnessName(attrs, message), ts)+ event := newBeaconEvent(action, eventCategory(action, firstString(attrs, "beacon.event.category", "event.category", "category")), severity(record.SeverityText(), record.SeverityNumber().String()), harnessName(attrs, message), ts)event.Message = messagee.populateCommon(&event, attrs)event.Raw = e.rawPayload(attrs, map[string]interface{}{@@ -135,7 +138,7 @@ func (e *beaconExporter) eventFromSpan(resourceAttrs map[string]interface{}, spaaction = inferAction(attrs, span.Name())}message := firstNonEmpty(firstString(attrs, "message", "gen_ai.prompt", "gen_ai.response"), span.Name())- event := newBeaconEvent(action, firstString(attrs, "beacon.event.category", "event.category", "tool"), spanSeverity(span.Status().Code().String()), harnessName(attrs, message, span.Name()), timestamp(span.StartTimestamp().AsTime()))+ event := newBeaconEvent(action, eventCategory(action, firstString(attrs, "beacon.event.category", "event.category", "tool")), spanSeverity(span.Status().Code().String()), harnessName(attrs, message, span.Name()), timestamp(span.StartTimestamp().AsTime()))event.Message = messagee.populateCommon(&event, attrs)event.Raw = e.rawPayload(attrs, map[string]interface{}{@@ -147,6 +150,69 @@ func (e *beaconExporter) eventFromSpan(resourceAttrs map[string]interface{}, spareturn event}+func shouldDropSpan(resourceAttrs map[string]interface{}, span ptrace.Span) bool {+ attrs := mergeMaps(resourceAttrs, attrsToMap(span.Attributes()))+ if harnessName(attrs, span.Name()) != "codex_cli" {+ return false+ }+ return isCodexInternalSpan(span.Name())+}++func isCodexInternalSpan(name string) bool {+ normalized := strings.ToLower(strings.TrimSpace(name))+ if normalized == "" {+ return true+ }+ keepPrefixes := []string{+ "codex.",+ "op.dispatch",+ "session_task.",+ "model_client.",+ "run_turn",+ "run_sampling_request",+ "try_run_sampling_request",+ "stream_request",+ "handle_responses",+ }+ for _, prefix := range keepPrefixes {+ if strings.HasPrefix(normalized, prefix) {+ return false+ }+ }+ dropExact := map[string]struct{}{+ "receiving": {},+ "receiving_stream": {},+ "poll": {},+ "poll_ready": {},+ "popped": {},+ "pop_frame": {},+ "reserve_capacity": {},+ "try_assign_capacity": {},+ "try_reclaim_frame": {},+ "assign_connection_capacity": {},+ "updating stream flow": {},+ "updating connection flow": {},+ "recv_stream_window_update": {},+ "recv_connection_window_update": {},+ "send_data": {},+ }+ if _, ok := dropExact[normalized]; ok {+ return true+ }+ dropPrefixes := []string{+ "framedread::",+ "framedwrite::",+ "hpack::",+ "prioritize::",+ }+ for _, prefix := range dropPrefixes {+ if strings.HasPrefix(normalized, prefix) {+ return true+ }+ }+ return false+}+func (e *beaconExporter) eventFromMetric(resourceAttrs map[string]interface{}, metric pmetric.Metric) beaconEvent {attrs := mergeMaps(resourceAttrs, map[string]interface{}{})event := newBeaconEvent(firstString(attrs, "beacon.event.action", "event.action", "metric.observed"), "metric", "info", harnessName(attrs, metric.Name()), time.Now().UTC())@@ -365,3 +431,27 @@ func inferAction(attrs map[string]interface{}, fallback string) string {return "tool.invoked"}}++func eventCategory(action, explicit string) string {+ if explicit != "" {+ return explicit+ }+ switch {+ case strings.HasPrefix(action, "prompt."):+ return "prompt"+ case strings.HasPrefix(action, "command."):+ return "command"+ case strings.HasPrefix(action, "file."):+ return "file"+ case strings.HasPrefix(action, "mcp."):+ return "mcp"+ case strings.HasPrefix(action, "approval.") || strings.HasPrefix(action, "policy."):+ return "approval"+ case strings.HasPrefix(action, "metric."):+ return "metric"+ case strings.HasPrefix(action, "tool."):+ return "tool"+ default:+ return ""+ }+}diff --git a/collector-builder/exporter/beaconjsonexporter/exporter_test.go b/collector-builder/exporter/beaconjsonexporter/exporter_test.goindex 9fdc12a0..d5f619d7 100644--- a/collector-builder/exporter/beaconjsonexporter/exporter_test.go+++ b/collector-builder/exporter/beaconjsonexporter/exporter_test.go@@ -10,6 +10,7 @@ import ("go.opentelemetry.io/collector/exporter""go.opentelemetry.io/collector/pdata/plog"+ "go.opentelemetry.io/collector/pdata/ptrace")func TestConfigValidateRequiresPath(t *testing.T) {@@ -64,6 +65,9 @@ func TestConsumeLogsWritesBeaconJSONL(t *testing.T) {if event.Vendor != vendor || event.Event.Action != "tool.invoked" || event.Harness.Name != "claude_cowork" {t.Fatalf("unexpected event: %#v", event)}+ if event.Event.Category != "tool" {+ t.Fatalf("event category = %q, want tool", event.Event.Category)+ }if event.Session == nil || event.Session.ID != "session-1" {t.Fatalf("session missing from event: %#v", event.Session)}@@ -72,6 +76,27 @@ func TestConsumeLogsWritesBeaconJSONL(t *testing.T) {}}+func TestEventCategoryInfersFromAction(t *testing.T) {+ tests := map[string]string{+ "tool.invoked": "tool",+ "file.modified": "file",+ "command.executed": "command",+ "mcp.tool_invoked": "mcp",+ "approval.requested": "approval",+ "policy.blocked": "approval",+ "prompt.submitted": "prompt",+ "metric.observed": "metric",+ }+ for action, want := range tests {+ if got := eventCategory(action, ""); got != want {+ t.Fatalf("eventCategory(%q) = %q, want %q", action, got, want)+ }+ }+ if got := eventCategory("tool.invoked", "custom"); got != "custom" {+ t.Fatalf("explicit category = %q, want custom", got)+ }+}+func TestMetadataRetentionDropsRawAttributes(t *testing.T) {exp, err := newExporter(&Config{Path: filepath.Join(t.TempDir(), "runtime.jsonl"),@@ -93,6 +118,63 @@ func TestMetadataRetentionDropsRawAttributes(t *testing.T) {}}+func TestCodexInternalSpanFilter(t *testing.T) {+ codexAttrs := map[string]interface{}{"service.name": "codex-cli"}++ if !shouldDropSpan(codexAttrs, testSpan("FramedRead::poll_next")) {+ t.Fatal("expected Codex transport span to be dropped")+ }+ if shouldDropSpan(codexAttrs, testSpan("session_task.turn")) {+ t.Fatal("expected meaningful Codex session span to be kept")+ }+ if shouldDropSpan(map[string]interface{}{"service.name": "other-agent"}, testSpan("FramedRead::poll_next")) {+ t.Fatal("expected non-Codex span to be kept")+ }+}++func TestConsumeTracesDropsCodexInternalSpans(t *testing.T) {+ path := filepath.Join(t.TempDir(), "runtime.jsonl")+ exp, err := newExporter(&Config{+ Path: path,+ MaxEventBytes: defaultMaxEventBytes,+ RotateBytes: defaultRotateBytes,+ RedactSecrets: true,+ ContentRetention: "metadata",+ }, exporter.Settings{})+ if err != nil {+ t.Fatalf("newExporter returned error: %v", err)+ }++ traces := ptrace.NewTraces()+ rs := traces.ResourceSpans().AppendEmpty()+ rs.Resource().Attributes().PutStr("service.name", "codex-cli")+ spans := rs.ScopeSpans().AppendEmpty().Spans()+ spans.AppendEmpty().SetName("FramedRead::poll_next")+ spans.AppendEmpty().SetName("session_task.turn")++ if err := exp.consumeTraces(context.Background(), traces); err != nil {+ t.Fatalf("consumeTraces returned error: %v", err)+ }+ data, err := os.ReadFile(path)+ if err != nil {+ t.Fatalf("read runtime log: %v", err)+ }+ text := string(data)+ if strings.Contains(text, "FramedRead::poll_next") {+ t.Fatalf("transport span was written: %s", text)+ }+ if !strings.Contains(text, "session_task.turn") {+ t.Fatalf("meaningful span was not written: %s", text)+ }+}++func testSpan(name string) ptrace.Span {+ traces := ptrace.NewTraces()+ span := traces.ResourceSpans().AppendEmpty().ScopeSpans().AppendEmpty().Spans().AppendEmpty()+ span.SetName(name)+ return span+}+func TestHarnessNameSeparatesClaudeCodeAndCowork(t *testing.T) {tests := []struct {name stringdiff --git a/packaging/macos/install-endpoint.sh b/packaging/macos/install-endpoint.shindex fcdc0aea..4b52c479 100755--- a/packaging/macos/install-endpoint.sh+++ b/packaging/macos/install-endpoint.sh@@ -21,6 +21,7 @@ if [ -z "$BEACON_COLLECTOR" ] && [ -x "/opt/beacon/bin/beacon-otelcol" ]; thenfiset -- endpoint install \+ --system \--harness "$BEACON_ENDPOINT_HARNESSES" \--content-retention "$BEACON_CONTENT_RETENTION" \--otlp-grpc-port "$BEACON_OTLP_GRPC_PORT" \diff --git a/packaging/macos/test-endpoint-scripts.sh b/packaging/macos/test-endpoint-scripts.shindex 0bee545b..bd5b740d 100644--- a/packaging/macos/test-endpoint-scripts.sh+++ b/packaging/macos/test-endpoint-scripts.sh@@ -34,7 +34,7 @@ STUB_LOG="$STUB_LOG" \INSTALL_ARGS="$(cat "$STUB_LOG")"case "$INSTALL_ARGS" in- "endpoint install --harness claude,codex,cursor --content-retention redacted --otlp-grpc-port 5317 --otlp-http-port 5318 --collector /tmp/beacon-otelcol") ;;+ "endpoint install --system --harness claude,codex,cursor --content-retention redacted --otlp-grpc-port 5317 --otlp-http-port 5318 --collector /tmp/beacon-otelcol") ;;*)echo "unexpected install args: $INSTALL_ARGS" >&2exit 1@@ -47,7 +47,7 @@ STUB_LOG="$STUB_LOG" \INSTALL_ARGS="$(cat "$STUB_LOG")"case "$INSTALL_ARGS" in- "endpoint install --harness claude --content-retention metadata --otlp-grpc-port 6317 --otlp-http-port 6318 --collector /tmp/jamf-otelcol --no-start") ;;+ "endpoint install --system --harness claude --content-retention metadata --otlp-grpc-port 6317 --otlp-http-port 6318 --collector /tmp/jamf-otelcol --no-start") ;;*)echo "unexpected Jamf positional install args: $INSTALL_ARGS" >&2exit 1@@ -62,7 +62,7 @@ STUB_LOG="$STUB_LOG" \UNINSTALL_ARGS="$(cat "$STUB_LOG")"case "$UNINSTALL_ARGS" in- "endpoint uninstall --keep-logs --keep-config") ;;+ "endpoint uninstall --system --keep-logs --keep-config") ;;*)echo "unexpected uninstall args with keep logs: $UNINSTALL_ARGS" >&2exit 1@@ -75,7 +75,7 @@ STUB_LOG="$STUB_LOG" \UNINSTALL_ARGS="$(cat "$STUB_LOG")"case "$UNINSTALL_ARGS" in- "endpoint uninstall --keep-logs --keep-config") ;;+ "endpoint uninstall --system --keep-logs --keep-config") ;;*)echo "unexpected Jamf positional uninstall args: $UNINSTALL_ARGS" >&2exit 1@@ -117,7 +117,7 @@ STUB_LOG="$STUB_LOG" \UNINSTALL_ARGS="$(cat "$STUB_LOG")"case "$UNINSTALL_ARGS" in- "endpoint uninstall") ;;+ "endpoint uninstall --system") ;;*)echo "unexpected uninstall args without keep logs: $UNINSTALL_ARGS" >&2exit 1diff --git a/packaging/macos/uninstall-endpoint.sh b/packaging/macos/uninstall-endpoint.shindex ae787878..ea0c8684 100755--- a/packaging/macos/uninstall-endpoint.sh+++ b/packaging/macos/uninstall-endpoint.sh@@ -12,7 +12,7 @@ fiBEACON_KEEP_LOGS="${BEACON_KEEP_LOGS:-${4:-0}}"BEACON_KEEP_CONFIG="${BEACON_KEEP_CONFIG:-${5:-0}}"-set -- endpoint uninstall+set -- endpoint uninstall --systemcase "$BEACON_KEEP_LOGS" in1|true|TRUE|yes|YES)