weiqingy commented on code in PR #869:
URL: https://github.com/apache/flink-agents/pull/869#discussion_r3524072148


##########
api/src/main/java/org/apache/flink/agents/api/event/ChatResponseEvent.java:
##########
@@ -46,7 +48,10 @@ public ChatResponseEvent(
         setAttr("total_retry_wait_sec", totalRetryWaitSec);
     }
 
-    public ChatResponseEvent(UUID id, Map<String, Object> attributes) {
+    @JsonCreator
+    public ChatResponseEvent(
+            @JsonProperty("id") UUID id,
+            @JsonProperty("attributes") Map<String, Object> attributes) {
         super(id, EVENT_TYPE, attributes);

Review Comment:
   Could the JSON creator rehydrate typed nested attributes during replay?
   
   With durable execution enabled, Jackson constructs `ChatResponseEvent` 
through this creator using the generic `attributes` map, so the nested 
`response` value stays a `LinkedHashMap`. Since replay dispatches the event as 
a concrete `ChatResponseEvent`, Java actions using the supported concrete 
signature can hit a `ClassCastException` when calling `event.getResponse()`.
   
   Would it make sense to normalize the typed nested attributes in the JSON 
creator, or before dispatch, so replayed built-in events match the live-path 
object shape? I think the same question applies to the other event creators 
added for typed nested attributes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to