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
Promote CI run context from record attributes
shukieshah1924a7cdd9a9
diff --git a/.github/workflows/claude-security-review-session.yml b/.github/workflows/claude-security-review-session.ymlindex d2337c48..61e2d178 100644--- a/.github/workflows/claude-security-review-session.yml+++ b/.github/workflows/claude-security-review-session.yml@@ -34,14 +34,13 @@ jobs:cd cli/beacongo build -o /tmp/beacon-session-test/beacon .- - name: Download released Beacon collector+ - name: Build branch Beacon collectorrun: |set -euo pipefail- archive=/tmp/beacon-session-test/beacon.tgz- curl -fsSL \- https://github.com/asymptote-labs/agent-beacon/releases/download/v0.0.49/beacon_0.0.49_linux_amd64.tar.gz \- -o "$archive"- tar -xzf "$archive" -C /tmp/beacon-session-test beacon-otelcol+ go install go.opentelemetry.io/collector/cmd/[email protected]+ cd collector-builder+ builder --config builder.yaml+ cp dist/beacon-otelcol/beacon-otelcol /tmp/beacon-session-test/beacon-otelcolchmod +x /tmp/beacon-session-test/beacon /tmp/beacon-session-test/beacon-otelcol- name: Start Beacon telemetrydiff --git a/.github/workflows/codex-action-session.yml b/.github/workflows/codex-action-session.ymlindex 7896d3d2..7c850e0f 100644--- a/.github/workflows/codex-action-session.yml+++ b/.github/workflows/codex-action-session.yml@@ -30,14 +30,13 @@ jobs:cd cli/beacongo build -o /tmp/beacon-session-test/beacon .- - name: Download released Beacon collector+ - name: Build branch Beacon collectorrun: |set -euo pipefail- archive=/tmp/beacon-session-test/beacon.tgz- curl -fsSL \- https://github.com/asymptote-labs/agent-beacon/releases/download/v0.0.49/beacon_0.0.49_linux_amd64.tar.gz \- -o "$archive"- tar -xzf "$archive" -C /tmp/beacon-session-test beacon-otelcol+ go install go.opentelemetry.io/collector/cmd/[email protected]+ cd collector-builder+ builder --config builder.yaml+ cp dist/beacon-otelcol/beacon-otelcol /tmp/beacon-session-test/beacon-otelcolchmod +x /tmp/beacon-session-test/beacon /tmp/beacon-session-test/beacon-otelcol- name: Start Beacon telemetrydiff --git a/collector-builder/exporter/beaconjsonexporter/exporter_test.go b/collector-builder/exporter/beaconjsonexporter/exporter_test.goindex ab7745e4..a83bcbcb 100644--- a/collector-builder/exporter/beaconjsonexporter/exporter_test.go+++ b/collector-builder/exporter/beaconjsonexporter/exporter_test.go@@ -244,6 +244,42 @@ func TestConsumeLogsMapsCIRunResourceAttributes(t *testing.T) {}}+func TestEventFromLogMapsCIRunRecordAttributes(t *testing.T) {+ exp, err := newExporter(&Config{+ Path: filepath.Join(t.TempDir(), "runtime.jsonl"),+ MaxEventBytes: defaultMaxEventBytes,+ RotateBytes: defaultRotateBytes,+ RedactSecrets: true,+ }, exporter.Settings{})+ if err != nil {+ t.Fatalf("newExporter returned error: %v", err)+ }+ rec := plog.NewLogRecord()+ rec.Body().SetStr("codex.user_prompt")+ attrs := rec.Attributes()+ attrs.PutStr("service.name", "codex_github_action")+ attrs.PutStr("event.name", "codex.user_prompt")+ attrs.PutStr(asymptoteobserve.AttributeOrigin, string(asymptoteobserve.OriginCI))+ attrs.PutStr(asymptoteobserve.AttributeRunProvider, "github_actions")+ attrs.PutStr(asymptoteobserve.AttributeRunRepository, "Asymptote-Labs%2Fagent-beacon")+ attrs.PutStr(asymptoteobserve.AttributeRunBranch, "beacon-ci-session-mode")+ attrs.PutStr(asymptoteobserve.AttributeRunPR, "refs%2Fpull%2F133%2Fmerge")+ attrs.PutStr(asymptoteobserve.AttributeRunPRNumber, "133")+ attrs.PutStr(asymptoteobserve.AttributeRunWorkflow, "Beacon%20Codex%20Action%20telemetry")+ attrs.PutBool(asymptoteobserve.AttributeRunEphemeral, true)++ event := exp.eventFromLog(nil, rec)+ if event.Origin != asymptoteobserve.OriginCI {+ t.Fatalf("Origin = %q, want ci", event.Origin)+ }+ if event.Run == nil {+ t.Fatal("Run missing from event")+ }+ if event.Run.Repository != "Asymptote-Labs/agent-beacon" || event.Run.PR != "refs/pull/133/merge" || event.Run.Workflow != "Beacon Codex Action telemetry" {+ t.Fatalf("run attributes were not promoted and decoded: %#v", event.Run)+ }+}+func TestConsumeLogsMapsPrompt(t *testing.T) {path := filepath.Join(t.TempDir(), "runtime.jsonl")exp, err := newExporter(&Config{diff --git a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/converter.go b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/converter.goindex 29343eba..6dd2558e 100644--- a/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/converter.go+++ b/collector-builder/exporter/beaconjsonexporter/internal/beaconevent/converter.go@@ -671,7 +671,7 @@ func MCPFromAttrs(attrs map[string]interface{}) *MCPInfo {}func populateRunContext(event *Event, attrs map[string]interface{}) {- switch FirstString(attrs, asymptoteobserve.AttributeOrigin) {+ switch RunString(attrs, asymptoteobserve.AttributeOrigin) {case string(asymptoteobserve.OriginLocal):event.Origin = asymptoteobserve.OriginLocalcase string(asymptoteobserve.OriginCloud):@@ -680,18 +680,18 @@ func populateRunContext(event *Event, attrs map[string]interface{}) {event.Origin = asymptoteobserve.OriginCI}run := RunInfo{- Provider: FirstString(attrs, asymptoteobserve.AttributeRunProvider),- RunID: FirstString(attrs, asymptoteobserve.AttributeRunID),- RunAttempt: FirstString(attrs, asymptoteobserve.AttributeRunAttempt),- Workflow: FirstString(attrs, asymptoteobserve.AttributeRunWorkflow),- Job: FirstString(attrs, asymptoteobserve.AttributeRunJob),- EventName: FirstString(attrs, asymptoteobserve.AttributeRunEventName),- Commit: FirstString(attrs, asymptoteobserve.AttributeRunCommit),- Repository: FirstString(attrs, asymptoteobserve.AttributeRunRepository),- Branch: FirstString(attrs, asymptoteobserve.AttributeRunBranch),- PR: FirstString(attrs, asymptoteobserve.AttributeRunPR),- PRNumber: FirstString(attrs, asymptoteobserve.AttributeRunPRNumber),- Actor: FirstString(attrs, asymptoteobserve.AttributeRunActor),+ Provider: RunString(attrs, asymptoteobserve.AttributeRunProvider),+ RunID: RunString(attrs, asymptoteobserve.AttributeRunID),+ RunAttempt: RunString(attrs, asymptoteobserve.AttributeRunAttempt),+ Workflow: RunString(attrs, asymptoteobserve.AttributeRunWorkflow),+ Job: RunString(attrs, asymptoteobserve.AttributeRunJob),+ EventName: RunString(attrs, asymptoteobserve.AttributeRunEventName),+ Commit: RunString(attrs, asymptoteobserve.AttributeRunCommit),+ Repository: RunString(attrs, asymptoteobserve.AttributeRunRepository),+ Branch: RunString(attrs, asymptoteobserve.AttributeRunBranch),+ PR: RunString(attrs, asymptoteobserve.AttributeRunPR),+ PRNumber: RunString(attrs, asymptoteobserve.AttributeRunPRNumber),+ Actor: RunString(attrs, asymptoteobserve.AttributeRunActor),}if ephemeral, ok := BoolAttr(attrs, asymptoteobserve.AttributeRunEphemeral); ok {run.Ephemeral = ephemeral@@ -742,6 +742,18 @@ func FirstString(attrs map[string]interface{}, keys ...string) string {return ""}+func RunString(attrs map[string]interface{}, keys ...string) string {+ value := FirstString(attrs, keys...)+ if value == "" {+ return ""+ }+ decoded, err := url.PathUnescape(value)+ if err != nil {+ return value+ }+ return decoded+}+func ToolCommandString(attrs map[string]interface{}) string {if command := FirstString(attrs, "tool.command", "command", "function_args"); command != "" {return command