wenjin272 opened a new issue, #1125:
URL: https://github.com/apache/flink-agents/issues/1125

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   Built-in events sent across the Python/Java boundary currently lose their 
concrete event type.
   
   Python serializes every event with `model_dump_json()` and 
`PythonRunnerContextImpl.sendEventJson()` reconstructs it with 
`Event.fromJson()`. Because the target is the base `Event` and `attributes` is 
`Map<String, Object>`, nested typed values are restored as generic maps. 
Individual Actions later call methods such as `ChatRequestEvent.fromEvent()`, 
but infrastructure that runs before the Action—Event Log, event listeners, and 
other runtime hooks—observes the generic event.
   
   This is visible in PR #1060: Python-originated chat requests hold messages 
and content blocks as maps when the Event Log runs, so the Event Log serializer 
registered for `ChatMessage.class` is bypassed. As a result, inline media 
`data` and signed-URL credentials or query parameters may be logged even though 
typed Java chat events use the metadata-only projection.
   
   The framework should restore registered built-in events at the 
JSON/cross-language boundary before dispatch, instead of requiring each Action 
to reconstruct its own event subtype. User-defined events should remain generic 
`Event` instances.
   
   A possible direction is a centralized built-in event registry or normalizer:
   
   `event type -> Event -> concrete built-in Event`
   
   It should be reused by all relevant deserialization boundaries rather than 
adding chat-specific logic to Event Log serialization.
   
   Acceptance criteria:
   
   - Known built-in event types are restored before EventRouter, Event Log, 
listeners, and actions.
   - Nested typed values such as `ChatMessage` are reconstructed consistently.
   - Unknown or user-defined event types remain generic `Event` instances.
   - Event ID, source timestamp, upstream event ID, and upstream action name 
are preserved.
   - Malformed built-in events fail clearly at the boundary.
   - Java, Python, and cross-language tests cover both typed restoration and 
custom-event fallback.
   - An Event Log regression test covers Python JSON -> Java Event -> 
STANDARD/VERBOSE logging and verifies that media data and URL credentials or 
query values are not retained.
   
   This should land before the 0.4 release. It can be implemented independently 
of PR #1060.
   
   Related:
   
   - #1055
   - #1060
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!
   


-- 
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