#2924·a2ui

[BUG]: Kotlin streaming parser emits basic catalog's Row as a placeholder whatever the catalog

Author: retz8Created Oct 1, 2026Updated Oct 1, 2026
Labelstype: bugP2status: needs reviewstatus: first-line-handled
  • I have searched the existing issues to make sure this bug has not already been reported.

Describe the Bug

While a surface streams, the Kotlin agent SDK's StreamingParser stands a placeholder in for each child a parent names before the child has arrived: loading_<childId>, and loading_children_<parentId> for a list still opening. The placeholder is hardcoded to the basic catalog's Row in both protocol versions:

  • StreamingParserV09.placeholderComponent: {"component": "Row", "children": []}
  • StreamingParserV08.placeholderComponent: {"component": {"Row": {"children": {"explicitList": []}}}}

and StreamingParser.addPlaceholderComponent adds it without checking that the catalog declares Row. What happens next depends on whether the parser can validate:

  • No catalog. The catalog parameter of StreamingParserV09, StreamingParserV08 and StreamingParser.create is nullable and defaults to null. Without a catalog there is no validator, so every intermediate update carries Row components, whatever catalog the surface's createSurface names. On a surface whose catalog has no Row, the React renderer draws Unknown component type: Row for each one until the children arrive.
  • A catalog without Row. The placeholders are still built. The validator rejects each update that carries one, and yieldMessages's non-strict fallback drops it because Row is not among the catalog's components. Nothing leaks, but only because validation discards the update; with validation off (as the conformance harness's disableValidation does), the Row placeholders go out.

The Python SDK already guards this. _can_use_placeholders() in python/a2ui_agent/src/a2ui/inference_formats/direct_json/streaming.py (added in #2537) emits a placeholder only when the catalog declares the placeholder's type, and otherwise holds the tree back until it is complete. The TypeScript streaming parser in #2916 carries the same check. Kotlin is the one SDK without it.

Steps to Reproduce

kotlin
val parser = StreamingParserV09(null)
parser.processChunk("""<a2ui-json>[{"version": "v0.9", "createSurface": {"surfaceId": "s1", "catalogId": "c1"}},""")
parser.processChunk("""{"version": "v0.9", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Stack", "children": ["c1", "c2"]}""")
// updateComponents: root (Stack), loading_c1 (Row), loading_c2 (Row)
parser.processChunk(""", {"id": "c1", "component": "Text", "text": "child 1"}""")
// updateComponents: c1 (Text), root (Stack), loading_c2 (Row)

StreamingParserV08(null) with the same tree in v0.8 form yields the same Row placeholders.

Expected Behavior

The same as the Python SDK: no placeholder unless the catalog declares its type. Otherwise the tree is held back until it is complete and goes out in one update (c1, c2, root).

Screenshots / Video / Logs

n/a

Environment Details

  • OS: macOS
  • Browser/Platform: JDK 21
  • SDK/Package Name & Version: Kotlin agent SDK (kotlin/agent_sdk_legacy, 0.1.0), main @ cc9526b6
  • Protocol Version: v0.8 and v0.9
  • Agent Framework & LLM Model: n/a

Additional Context

Suggested fix: port the Python check to the shared StreamingParser: a canUsePlaceholders() that is true only when the catalog's components declare the placeholder's type; the child reference traversal adds a placeholder only then; and yieldReachable otherwise yields only once the whole subtree under the root is complete.

The shared conformance case test_partial_single_child_string_v09 already expects this behavior on a catalog without Row. Kotlin passes it only because validation drops the update. A disableValidation: true variant of that case pins the behavior for every SDK.