Skip to content

[FLINK-AGENTS][api] Fix Kryo deserialization failure for Event classes with immutable lists#677

Open
avichaym wants to merge 1 commit into
apache:mainfrom
avichaym:fix/kryo-immutable-list-serialization
Open

[FLINK-AGENTS][api] Fix Kryo deserialization failure for Event classes with immutable lists#677
avichaym wants to merge 1 commit into
apache:mainfrom
avichaym:fix/kryo-immutable-list-serialization

Conversation

@avichaym
Copy link
Copy Markdown
Contributor

fixes #673

Wraps list arguments in new ArrayList<>() before passing to setAttr() in ChatRequestEvent, ContextRetrievalResponseEvent, and ToolRequestEvent. Without this, passing List.of(...) crashes Kryo on JDK 17+ with InaccessibleObjectException.

…s with immutable lists

Wrap List arguments in new ArrayList<>() in event constructors so callers
can safely pass List.of(...), Arrays.asList(...), or any immutable list
without hitting a JDK 17+ Kryo InaccessibleObjectException at runtime.

Affected events: ChatRequestEvent (messages), ContextRetrievalResponseEvent
(documents), ToolRequestEvent (tool_calls).

The defensive copy is applied before setAttr() so the stored list is always
a plain mutable ArrayList that Kryo can serialize without reflective access
to sealed JDK internal classes.
@github-actions github-actions Bot added doc-label-missing The Bot applies this label either because none or multiple labels were provided. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-label-missing The Bot applies this label either because none or multiple labels were provided. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Kryo serialization fails for Event classes with immutable lists on JDK 17+

1 participant