Skip to content

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

Fix harness scope: normalize both sides of the harness filter in matchesQuery

Cursor Agent5d91bead3992
diff --git a/cli/beacon/cmd/token_usage_test.go b/cli/beacon/cmd/token_usage_test.go
index 02bb8e1a..e11246cd 100644
--- a/cli/beacon/cmd/token_usage_test.go
+++ b/cli/beacon/cmd/token_usage_test.go
@@ -265,18 +265,22 @@ func TestTokenUsageCoverageHarnessScopeDoesNotStrandOtherRuntimes(t *testing.T)
}
}
- output := runTokenUsageCommand(t, "--log-path", logPath, "--coverage", "--json", "--harness", "claude_code")
- var report tokens.CoverageReport
- if err := json.Unmarshal([]byte(output), &report); err != nil {
- t.Fatalf("unmarshal coverage report: %v\n%s", err, output)
- }
- for _, runtime := range report.Runtimes {
- if runtime.Harness != "claude_code" {
- t.Errorf("scoping to claude_code still reported %q as %q", runtime.Harness, runtime.Status)
- }
- }
- if len(report.Runtimes) != 1 || report.Runtimes[0].Status != tokens.CoverageCovered {
- t.Fatalf("want exactly the scoped runtime, covered; got %+v", report.Runtimes)
+ for _, alias := range []string{"claude_code", "claude"} {
+ t.Run("harness="+alias, func(t *testing.T) {
+ output := runTokenUsageCommand(t, "--log-path", logPath, "--coverage", "--json", "--harness", alias)
+ var report tokens.CoverageReport
+ if err := json.Unmarshal([]byte(output), &report); err != nil {
+ t.Fatalf("unmarshal coverage report: %v\n%s", err, output)
+ }
+ for _, runtime := range report.Runtimes {
+ if runtime.Harness != "claude_code" {
+ t.Errorf("scoping to %q still reported %q as %q", alias, runtime.Harness, runtime.Status)
+ }
+ }
+ if len(report.Runtimes) != 1 || report.Runtimes[0].Status != tokens.CoverageCovered {
+ t.Fatalf("want exactly the scoped runtime, covered; got %+v", report.Runtimes)
+ }
+ })
}
}
diff --git a/cli/beacon/internal/endpoint/dashboard/events.go b/cli/beacon/internal/endpoint/dashboard/events.go
index 39c4d18e..e8d8dd38 100644
--- a/cli/beacon/internal/endpoint/dashboard/events.go
+++ b/cli/beacon/internal/endpoint/dashboard/events.go
@@ -587,7 +587,7 @@ func matchesQuery(record EventRecord, query EventQuery) bool {
return false
}
}
- if query.Harness != "" && !strings.EqualFold(event.Harness.Name, query.Harness) {
+ if query.Harness != "" && !strings.EqualFold(asymptoteobserve.NormalizeHarnessName(event.Harness.Name), asymptoteobserve.NormalizeHarnessName(query.Harness)) {
return false
}
if query.Model != "" && !containsFold(event.Model, query.Model) {
diff --git a/cli/beacon/internal/endpoint/dashboard/events_test.go b/cli/beacon/internal/endpoint/dashboard/events_test.go
index 4dfe6d19..f84656d8 100644
--- a/cli/beacon/internal/endpoint/dashboard/events_test.go
+++ b/cli/beacon/internal/endpoint/dashboard/events_test.go
@@ -194,8 +194,8 @@ func TestDashboardAPIsSurfaceVSCodeEvents(t *testing.T) {
if err := json.Unmarshal(rec.Body.Bytes(), &result); err != nil {
t.Fatalf("unmarshal events: %v", err)
}
- if result.TotalMatched != 2 {
- t.Fatalf("vscode filtered events = %d, want 2", result.TotalMatched)
+ if result.TotalMatched != 3 {
+ t.Fatalf("vscode filtered events = %d, want 3", result.TotalMatched)
}
}