Skip to content

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

Fix content.retention validation to accept empty values for backward compatibility

Cursor Agentb8facd35c768
diff --git a/pkg/asymptoteobserve/event.go b/pkg/asymptoteobserve/event.go
index e37b550a..e4c8366a 100644
--- a/pkg/asymptoteobserve/event.go
+++ b/pkg/asymptoteobserve/event.go
@@ -434,7 +434,7 @@ func (e Event) Validate() error {
return errors.New("origin must be local, cloud, or ci")
}
}
- if e.Content != nil {
+ if e.Content != nil && e.Content.Retention != "" {
switch e.Content.Retention {
case ContentRetentionMetadata, ContentRetentionRedacted, ContentRetentionFull:
default:
diff --git a/pkg/asymptoteobserve/event_test.go b/pkg/asymptoteobserve/event_test.go
index 64b0f11e..d0ebf877 100644
--- a/pkg/asymptoteobserve/event_test.go
+++ b/pkg/asymptoteobserve/event_test.go
@@ -50,6 +50,17 @@ func TestNewEventSetsRequiredInvariants(t *testing.T) {
}
}
+func TestValidateContentEmptyRetentionAccepted(t *testing.T) {
+ event := NewEvent(NewEventOptions{
+ Action: "tool.invoked",
+ Harness: HarnessInfo{Name: "cursor"},
+ })
+ event.Content = &ContentInfo{Retention: "", Included: false}
+ if err := event.Validate(); err != nil {
+ t.Fatalf("Validate rejected empty content.retention: %v", err)
+ }
+}
+
func TestValidateContentRetentionValuesForCompatibility(t *testing.T) {
for _, retention := range []string{ContentRetentionMetadata, ContentRetentionRedacted, ContentRetentionFull} {
t.Run(retention, func(t *testing.T) {