[fix] Fix ReActAgent failure when output schema is null.#838
Conversation
Backport of apache#837 to release-0.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
weiqingy
left a comment
There was a problem hiding this comment.
Thanks for tracking this down — omitting the output_schema key when it's null is the right fix (the old null value was what ActionJsonSerializer choked on, and an absent key reads back as null/None just the same), and nice that the Java and Python sides stay symmetric. One question on the new Java test inline.
| .apply(agent) | ||
| .toDataStream(); | ||
|
|
||
| out.print(); |
There was a problem hiding this comment.
This test passes as long as env.execute() doesn't throw, so it covers "the plan serializes and the job runs" — which is the crash this PR fixes — but it doesn't pin the contract the no-schema path establishes: that the output comes back as a String. The Python counterpart goes a step further with assert len(output_list) == 1 and assert isinstance(output_list[0]["0001"], str), and the schema-case Java test routes through checkResult(...) for an exact value check. Would it be worth collecting the output here too — collectAsync() like the schema test, then asserting hasNext() and that the value is a String — so a regression that emitted nothing or wrongly took the STRUCTURED_OUTPUT branch in stopAction would fail on the Java side as well? Or is the intent to keep the Java e2e deliberately lighter than the Python one?
There was a problem hiding this comment.
Good catch. I agree that the Java test also needs to validate the results, and I will update this PR accordingly.
Additionally, since this fix has already been merged into the main branch, I will open a separate PR later to update the Java tests on the main branch as well.
Purpose of change
Fix ReActAgent failure when output schema is null
Tests
it
API
no
Documentation
doc-neededdoc-not-neededdoc-included