You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by we...@apache.org on 2026/09/16 01:42:12 UTC

(flink-agents) branch main updated: [e2e][java][hotfix] Deep-copy Mem0 action event payload (#1123)

This is an automated email from the ASF dual-hosted git repository.

wenjin272 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git


The following commit(s) were added to refs/heads/main by this push:
     new 43cce6bf [e2e][java][hotfix] Deep-copy Mem0 action event payload (#1123)
43cce6bf is described below

commit 43cce6bf876cb43c9de8c3323a1d9cc57821fe17
Author: Wenjin Xie <16...@users.noreply.github.com>
AuthorDate: Wed Sep 16 09:42:05 2026 +0800

    [e2e][java][hotfix] Deep-copy Mem0 action event payload (#1123)
    
    Generated-by: Codex (GPT-5)
    
    Co-authored-by: Codex <co...@openai.com>
---
 .../apache/flink/agents/resource/test/Mem0LongTermMemoryAgent.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/e2e-test/flink-agents-end-to-end-tests-resource-cross-language/src/test/java/org/apache/flink/agents/resource/test/Mem0LongTermMemoryAgent.java b/e2e-test/flink-agents-end-to-end-tests-resource-cross-language/src/test/java/org/apache/flink/agents/resource/test/Mem0LongTermMemoryAgent.java
index 04e1970a..bd7e6406 100644
--- a/e2e-test/flink-agents-end-to-end-tests-resource-cross-language/src/test/java/org/apache/flink/agents/resource/test/Mem0LongTermMemoryAgent.java
+++ b/e2e-test/flink-agents-end-to-end-tests-resource-cross-language/src/test/java/org/apache/flink/agents/resource/test/Mem0LongTermMemoryAgent.java
@@ -17,6 +17,7 @@
  */
 package org.apache.flink.agents.resource.test;
 
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.flink.agents.api.Event;
 import org.apache.flink.agents.api.EventType;
@@ -72,6 +73,8 @@ public class Mem0LongTermMemoryAgent extends Agent {
     private static final String DEFAULT_BASE_URL = "https://coding.dashscope.aliyuncs.com/v1";
 
     private static final ObjectMapper MAPPER = new ObjectMapper();
+    private static final TypeReference<Map<String, Object>> RECORD_TYPE =
+            new TypeReference<Map<String, Object>>() {};
 
     public static final String MyEvent = "MyEvent";
 
@@ -213,10 +216,9 @@ public class Mem0LongTermMemoryAgent extends Agent {
         ctx.sendEvent(new Event(MyEvent, Map.of("value", record)));
     }
 
-    @SuppressWarnings("unchecked")
     @Action(MyEvent)
     public static void retrieveItems(Event event, RunnerContext ctx) throws Exception {
-        Map<String, Object> record = (Map<String, Object>) event.getAttr("value");
+        Map<String, Object> record = MAPPER.convertValue(event.getAttr("value"), RECORD_TYPE);
         record.put("timestamp_second_action", Instant.now().toString());
 
         MemorySet memorySet = ctx.getLongTermMemory().getMemorySet(MEMORY_SET_NAME);