Skip to content

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

Fix FindEvent using archive number as slice index

Cursor Agentae488e457dd0
diff --git a/cli/beacon/internal/endpoint/dashboard/events.go b/cli/beacon/internal/endpoint/dashboard/events.go
index f620e880..dbbb26da 100644
--- a/cli/beacon/internal/endpoint/dashboard/events.go
+++ b/cli/beacon/internal/endpoint/dashboard/events.go
@@ -137,15 +137,14 @@ func readEventsFromSource(source eventSource, query EventQuery, result *EventRes
}
func FindEvent(path, id string) (EventRecord, bool, error) {
- sourceIndex, lineNo, ok := parseRecordID(id)
+ archiveNum, lineNo, ok := parseRecordID(id)
if !ok {
return EventRecord{}, false, nil
}
- sources := eventSources(path)
- if sourceIndex >= len(sources) {
+ source, found := findSource(eventSources(path), archiveNum)
+ if !found {
return EventRecord{}, false, nil
}
- source := sources[sourceIndex]
file, err := os.Open(source.path)
if err != nil {
if os.IsNotExist(err) {
@@ -228,6 +227,15 @@ func eventSources(path string) []eventSource {
return append(sources, archives...)
}
+func findSource(sources []eventSource, archive int) (eventSource, bool) {
+ for _, s := range sources {
+ if s.archive == archive {
+ return s, true
+ }
+ }
+ return eventSource{}, false
+}
+
func normalizeDashboardEvent(event *schema.Event) {
metricName := metricEventName(event)
if event.Event.Category == "" && metricName != "" {