Skip to content

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

fix(lenses): make the trace event policy block searchable

Claude5eb56982d486
diff --git a/cli/beacon/internal/endpoint/dashboard/history_test.go b/cli/beacon/internal/endpoint/dashboard/history_test.go
index a1061d7b..e9d50dd9 100644
--- a/cli/beacon/internal/endpoint/dashboard/history_test.go
+++ b/cli/beacon/internal/endpoint/dashboard/history_test.go
@@ -102,7 +102,7 @@ func traceAnswers(t *testing.T, path string, showIDs []string) map[string]string
queries := []string{
"", "index", "INDEX LOCAL", "go", "go test", "dashboard go", "endpoint.dashboard", "endpoint/dashboard",
"(", `"quoted"`, "a-b", "path:/repo", "*", "AND", "NEAR", "ü", "naïve café", "claude_code.token.usage",
- "nothing-matches-this", " ", "evt", "s1", "codex_cli", "retained answer",
+ "nothing-matches-this", " ", "evt", "s1", "codex_cli", "retained answer", "no-near enforce",
}
for _, q := range queries {
for _, page := range []int{1, 2} {
@@ -985,5 +985,10 @@ func TestTraceEventsCarryThePolicyBlock(t *testing.T) {
if policy == nil || *policy != want {
t.Fatalf("%s: e5 policy = %#v, want %#v", name, policy, want)
}
+ // The policy block is searchable, like the approval beside it.
+ found, err := SearchTraces(path, TraceQuery{EventQuery: EventQuery{Q: "no-near"}, ResultLevel: "event", Limit: 10})
+ if err != nil || found.TotalMatched != 1 || found.Events[0].Event.ID != "e5" {
+ t.Fatalf("%s: search for the policy id = %+v, %v", name, found, err)
+ }
}
}
diff --git a/cli/beacon/internal/endpoint/dashboard/traces.go b/cli/beacon/internal/endpoint/dashboard/traces.go
index 50121412..084328f9 100644
--- a/cli/beacon/internal/endpoint/dashboard/traces.go
+++ b/cli/beacon/internal/endpoint/dashboard/traces.go
@@ -1053,6 +1053,9 @@ func traceEventHaystack(event TraceEventV1) string {
}),
valueOrEmpty(event.MCP, func(m *TraceMCPV1) string { return m.Server + " " + m.Tool + " " + m.Method + " " + m.ResourceURI }),
valueOrEmpty(event.Approval, func(a *TraceApprovalV1) string { return a.Decision + " " + a.Reason }),
+ valueOrEmpty(event.Policy, func(p *TracePolicyV1) string {
+ return p.ID + " " + p.Name + " " + p.Decision + " " + p.Enforcement + " " + p.Reason
+ }),
}, "\n")
}