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
package codexsession
import (
"fmt"
"path/filepath"
"testing"
"time"
"github.com/asymptote-labs/agent-beacon/cli/beacon/internal/sessionsync/sessionsynctest"
)
// A sync larger than the rotation window used to rotate its own first events away while moving
// every cursor past them, and report success (#973).
func TestCollectOnceKeepsWhatItWritesAcrossTheRotationWindow(t *testing.T) {
const sessions = 60
dir := t.TempDir()
codexDir := filepath.Join(dir, ".codex")
now := time.Now()
for i := 0; i < sessions; i++ {
writeDatedSession(t, codexDir, fmt.Sprintf("s%03d", i), now.Add(-time.Duration(i+1)*time.Minute))
}
opts := CollectOptions{CodexDir: codexDir, Write: true, UserMode: true}
sessionsynctest.CheckSweepKeepsItsOutput(t, func(statePath, logPath string, rotateBytes int64) (sessionsynctest.Result, error) {
opts.StatePath, opts.LogPath, opts.RotateBytes = statePath, logPath, rotateBytes
s, err := CollectOnce(opts)
return sessionsynctest.Result{EventsEmitted: s.EventsEmitted, Errors: s.Errors, Retention: s.Retention}, err
})
}