Skip to content

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

Fix system cursor path and equal-timestamp skip in OpenClaw session collector

Cursor Agent43bff5c44350
diff --git a/cli/beacon/cmd/endpoint_openclaw_sessions.go b/cli/beacon/cmd/endpoint_openclaw_sessions.go
index 6ba3074b..0d5347cd 100644
--- a/cli/beacon/cmd/endpoint_openclaw_sessions.go
+++ b/cli/beacon/cmd/endpoint_openclaw_sessions.go
@@ -8,6 +8,7 @@ import (
"strings"
"time"
+ endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/lifecycle"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/openclawsession"
"github.com/spf13/cobra"
@@ -215,9 +216,8 @@ func resolveOpenClawSessionsStatePath(path string, userMode bool) string {
if strings.TrimSpace(path) != "" {
return path
}
- base := filepath.Join("/var", "lib", "beacon", "endpoint", "state")
if userMode {
- base = filepath.Dir(openclawsession.DefaultStatePath())
+ return openclawsession.DefaultStatePath()
}
- return filepath.Join(base, "openclaw-sessions.json")
+ return filepath.Join(endpointconfig.BaseDir(false), "state", "openclaw-sessions.json")
}
diff --git a/cli/beacon/internal/openclawsession/collect.go b/cli/beacon/internal/openclawsession/collect.go
index 34e19e8e..39ba70d7 100644
--- a/cli/beacon/internal/openclawsession/collect.go
+++ b/cli/beacon/internal/openclawsession/collect.go
@@ -148,7 +148,7 @@ func CollectOnce(opts CollectOptions) (summary Summary, err error) {
func collectTrace(store *Store, ref TraceRef, state *State, opts CollectOptions, summary *Summary) (bool, error) {
cursor := state.cursor(ref)
- if ref.UpdatedAtUnixMS > 0 && ref.UpdatedAtUnixMS <= cursor.UpdatedAtMS {
+ if ref.UpdatedAtUnixMS > 0 && ref.UpdatedAtUnixMS < cursor.UpdatedAtMS {
return false, nil
}
records, err := store.Read(ref)