rosemarYuan opened a new pull request, #869: URL: https://github.com/apache/flink-agents/pull/869
Linked issue: #868 ### Purpose of change `ActionStateSerde` uses Jackson polymorphic deserialization (`@JsonTypeInfo(Id.CLASS)`) to restore the concrete `Event` subclasses persisted in `ActionState` (`taskEvent` / `outputEvents`) for durable execution recovery. Jackson requires each concrete subclass to declare its own creator — the `@JsonCreator` on the base `Event` constructor is not inherited. Only `InputEvent`/`OutputEvent` annotate their `(UUID, Map<String, Object>)` constructors with `@JsonCreator/@JsonProperty`. The six built-in event subclasses under `org.apache.flink.agents.api.event.*` (`ChatRequestEvent`, `ChatResponseEvent`, `ToolRequestEvent`, `ToolResponseEvent`, `ContextRetrievalRequestEvent`, `ContextRetrievalResponseEvent`) have the same constructors but lack the annotations, so deserializing any of them from a persisted `ActionState` fails with: ``` InvalidDefinitionException: Cannot construct instance of `...ChatRequestEvent` (no Creators, like default constructor, exist) ``` This PR annotates the `(UUID, Map<String, Object>)` constructor of all six classes, consistent with `InputEvent`/`OutputEvent`. ### Tests Added `ActionStateSerdeTest#testBuiltinChatToolAndContextEventsRoundTripThroughOutputEvents`, which: - round-trips all six built-in events through `ActionStateSerde` both as `taskEvent` and inside `outputEvents`, asserting the concrete class is restored (fails with the exception above without the fix); - additionally asserts that nested attributes come back as their expected types via the `fromEvent()` consumption path used by the built-in actions (`ChatMessage`, `ToolResponse`, `Document`, and `UUID` request ids), not raw maps. Verified with `mvn -pl runtime test -Dtest=ActionStateSerdeTest` (11/11 pass) and the full `api` module test suite. ### API No signature changes. Adds Jackson annotations to existing public constructors of the six built-in event classes; serialized JSON format is unchanged. ### Documentation - [ ] `doc-needed` - [x] `doc-not-needed` - [ ] `doc-included` 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
