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(openclaw): validate gateway OTLP only from OTLP events (#852)
Rudy Mizrahi Celeklif499d58bad30
diff --git a/cli/beacon/internal/endpoint/integrations/openclaw/openclaw.go b/cli/beacon/internal/endpoint/integrations/openclaw/openclaw.goindex 22758d56..d5139f94 100644--- a/cli/beacon/internal/endpoint/integrations/openclaw/openclaw.go+++ b/cli/beacon/internal/endpoint/integrations/openclaw/openclaw.go@@ -6,6 +6,7 @@ import ("time""github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/integrations"+ "github.com/asymptote-labs/agent-beacon/pkg/asymptoteobserve")const (@@ -132,13 +133,16 @@ func GetStatus(logPath string) Status {}func HasRecentOpenClawEvent(logPath string) bool {- return integrations.HasRecentHarnessEvent(logPath, Name)+ _, ok := LastOpenClawEvent(logPath)+ return ok}func HasOpenClawEventSince(logPath string, since time.Time) bool {- return integrations.HasHarnessEventSince(logPath, Name, since)+ last, ok := LastOpenClawEvent(logPath)+ return ok && !last.IsZero() && !last.Before(since)}func LastOpenClawEvent(logPath string) (time.Time, bool) {- return integrations.LastHarnessEvent(logPath, Name)+ // This integration validates gateway OTLP; plugin and poll events share the harness name.+ return integrations.LastHarnessEventByCollectionMethod(logPath, Name, asymptoteobserve.CollectionMethodOTLP)}diff --git a/cli/beacon/internal/endpoint/integrations/openclaw/openclaw_test.go b/cli/beacon/internal/endpoint/integrations/openclaw/openclaw_test.goindex 2fe17919..9ff1a06d 100644--- a/cli/beacon/internal/endpoint/integrations/openclaw/openclaw_test.go+++ b/cli/beacon/internal/endpoint/integrations/openclaw/openclaw_test.go@@ -1,6 +1,7 @@package openclawimport (+ "fmt""os""path/filepath""strings"@@ -33,7 +34,7 @@ func TestOpenClawEventStatusAndSince(t *testing.T) {path := filepath.Join(t.TempDir(), "runtime.jsonl")data := strings.Join([]string{`{"timestamp":"2026-05-13T16:18:40Z","harness":{"name":"cursor"}}`,- `{"timestamp":"2026-05-13T16:20:40Z","harness":{"name":"openclaw_gateway"}}`,+ `{"timestamp":"2026-05-13T16:20:40Z","harness":{"name":"openclaw_gateway","collection_method":"otlp"}}`,"",}, "\n")if err := os.WriteFile(path, []byte(data), 0644); err != nil {@@ -58,3 +59,43 @@ func TestOpenClawEventStatusAndSince(t *testing.T) {t.Fatalf("LastEventObservedAt = %q, want %q", got, want)}}++func TestOTLPValidationSeparatesOtherCollectionMethods(t *testing.T) {+ old := time.Date(2026, 10, 13, 10, 0, 0, 0, time.UTC)+ recent := old.Add(2 * time.Hour)+ row := func(method string, timestamp time.Time) string {+ return fmt.Sprintf(`{"timestamp":%q,"harness":{"name":"openclaw-gateway","collection_method":%q}}`, timestamp.Format(time.RFC3339Nano), method)+ }+ for _, test := range []struct {+ name string+ rows []string+ observed bool+ last time.Time+ }{+ {"otlp", []string{row("otlp", old)}, true, old},+ {"plugin", []string{row("plugin", recent)}, false, time.Time{}},+ {"poll", []string{row("poll", recent)}, false, time.Time{}},+ {"hook", []string{row("hook", recent)}, false, time.Time{}},+ {"newer plugin does not refresh old otlp", []string{row("otlp", old), row("plugin", recent)}, true, old},+ } {+ t.Run(test.name, func(t *testing.T) {+ path := filepath.Join(t.TempDir(), "runtime.jsonl")+ if err := os.WriteFile(path, []byte(strings.Join(test.rows, "\n")+"\n"), 0600); err != nil {+ t.Fatal(err)+ }+ status := GetStatus(path)+ if got := HasRecentOpenClawEvent(path); got != test.observed {+ t.Fatalf("observed = %v, want %v", got, test.observed)+ }+ if status.LastEventObserved != test.observed {+ t.Fatalf("status observed = %v, want %v", status.LastEventObserved, test.observed)+ }+ if !test.last.IsZero() && status.LastEventObservedAt != test.last.Format(time.RFC3339) {+ t.Fatalf("last timestamp = %s, want %s", status.LastEventObservedAt, test.last)+ }+ if HasOpenClawEventSince(path, old.Add(time.Hour)) {+ t.Fatal("non-OTLP events must not refresh OTLP validation")+ }+ })+ }+}diff --git a/docs/cli/openclaw.mdx b/docs/cli/openclaw.mdxindex 6b1bf3e8..db116989 100644--- a/docs/cli/openclaw.mdx+++ b/docs/cli/openclaw.mdx@@ -100,7 +100,7 @@ beacon endpoint integrations openclaw print-config \## beacon endpoint integrations openclaw status-`beacon endpoint integrations openclaw status` reports whether OpenClaw OTLP-derived events have been observed in the endpoint runtime log.+`beacon endpoint integrations openclaw status` reports whether OpenClaw OTLP-derived events have been observed in the endpoint runtime log. Plugin, native hook, and session-poll events do not count as evidence that gateway OTLP export is working.```bash title="Check status"beacon endpoint integrations openclaw status