Skip to content

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

Fix content marker limits: Devin assistant truncation and diff marker overwrite

Cursor Agent9813e73b927f
diff --git a/cli/beacon-hooks/cmd/cline_event.go b/cli/beacon-hooks/cmd/cline_event.go
index 8fba0770..3eeb3c4c 100644
--- a/cli/beacon-hooks/cmd/cline_event.go
+++ b/cli/beacon-hooks/cmd/cline_event.go
@@ -622,8 +622,10 @@ func clineToolFields(input map[string]interface{}, completed bool) map[string]in
}
}
- if encoded, err := json.Marshal(map[string]interface{}{"input": toolInput, "response": toolResponse}); err == nil && len(encoded) > 0 {
- fields["content"] = retainedContentFields(string(encoded))
+ if _, hasContent := fields["content"]; !hasContent {
+ if encoded, err := json.Marshal(map[string]interface{}{"input": toolInput, "response": toolResponse}); err == nil && len(encoded) > 0 {
+ fields["content"] = retainedContentFields(string(encoded))
+ }
}
return fields
}
diff --git a/cli/beacon-hooks/cmd/opencode_event.go b/cli/beacon-hooks/cmd/opencode_event.go
index a75aaf66..12d9496e 100644
--- a/cli/beacon-hooks/cmd/opencode_event.go
+++ b/cli/beacon-hooks/cmd/opencode_event.go
@@ -336,8 +336,10 @@ func opencodeToolFields(input map[string]interface{}, completed bool) map[string
fields["command"] = commandFields
}
}
- if encoded, err := json.Marshal(map[string]interface{}{"input": toolInput, "response": toolResponse}); err == nil && len(encoded) > 0 {
- fields["content"] = retainedContentFields(string(encoded))
+ if _, hasContent := fields["content"]; !hasContent {
+ if encoded, err := json.Marshal(map[string]interface{}{"input": toolInput, "response": toolResponse}); err == nil && len(encoded) > 0 {
+ fields["content"] = retainedContentFields(string(encoded))
+ }
}
return fields
}
diff --git a/cli/beacon/internal/devincloud/mapper.go b/cli/beacon/internal/devincloud/mapper.go
index efc2452e..cd4d3dff 100644
--- a/cli/beacon/internal/devincloud/mapper.go
+++ b/cli/beacon/internal/devincloud/mapper.go
@@ -72,18 +72,17 @@ func MapSession(s Session, msgs []Message) []MappedEvent {
seen := map[string]bool{}
for i, m := range msgs {
dedupID := messageDedupID(s.SessionID, m, i, seen)
- // The marker used to assert full retention with no hash and no byte count,
- // which is the half of it that carries information: without them a reader
- // cannot tell a short message from a truncated long one, and has nothing
- // stable to identify the text by. Both fields hold the message at
- // DefaultStringLimit, so that is the limit the marker answers against.
- //
// RetainedContent returns nil for an empty message, and the message shapes
// are built only alongside it, so a message with no text gets neither a
// marker claiming retention nor a message part with empty content.
- content := asymptoteobserve.RetainedContent(m.Message, asymptoteobserve.DefaultStringLimit)
+ //
+ // The limit passed to RetainedContent must match the limit SanitizeEvent
+ // applies to the field the text actually lives in: prompt.text is sanitized
+ // at DefaultStringLimit, while gen_ai (where assistant text lands) is
+ // sanitized at DefaultRawStringLimit.
switch strings.ToLower(m.Source) {
case "user":
+ content := asymptoteobserve.RetainedContent(m.Message, asymptoteobserve.DefaultStringLimit)
ev := baseEvent(s, "prompt.submitted", "prompt", schema.SeverityInfo, m.CreatedAt)
ev.Prompt = &schema.PromptInfo{Text: m.Message}
if content != nil {
@@ -95,6 +94,7 @@ func MapSession(s Session, msgs []Message) []MappedEvent {
ev.Message = "Devin Cloud user prompt"
out = append(out, MappedEvent{DedupID: dedupID, Event: ev})
default: // "devin" (assistant) and any future agent-side source
+ content := asymptoteobserve.RetainedContent(m.Message, asymptoteobserve.DefaultRawStringLimit)
ev := baseEvent(s, "agent.message", "session", schema.SeverityInfo, m.CreatedAt)
// The assistant's text reached the log only as the event message, which
// is a free-text label rather than a payload anything can match on. It