Repository navigation
Description
Describe the bug
AguiMessageConverter.toAguiMessages(Msg) loses supported URL-backed media when an assistant message contains a ThinkingBlock and media but no TextBlock or tool call. It returns only a reasoning message. toAguiMessageList(...) loses the media in the same way, so a consumer converting a conversation/history never receives the generated image, audio, video, or document URL.
This is an interaction between reasoning-message splitting and the outbound URL-media support added in #4003. It is distinct from the inbound document/error-handling issue #3392 and the general multimodal feature #551.
To reproduce
On main dc077e7abfc4b2dd1062f2279dad48382256b819:
var converter = new AguiMessageConverter();
var message = Msg.builder()
.role(MsgRole.ASSISTANT)
.content(
ThinkingBlock.builder().thinking("Generate the requested output").build(),
ImageBlock.builder().source(URLSource.builder()
.url("https://example.com/generated-output")
.mimeType("image/png").build()).build())
.build();
var converted = converter.toAguiMessages(message);
System.out.println(converted.size()); // actual: 1; expected: 2The classes above are from io.agentscope.core.agui.converter and io.agentscope.core.message. No model invocation, URL download, provider credential, or running server is required.
Expected behavior
Return a reasoning message followed by an assistant message carrying the URL-backed media in MessageContent.Blocks, as documented for mixed reasoning/content messages. Preserve the URL and MIME type. A reasoning-only input should still return one message.
Actual behavior / error messages
No exception is raised: the media is silently omitted. An offline regression using the public converter APIs produces 8 tests, 7 failures, 0 errors against unchanged production code. Six failures cover image/audio/video/document and image/document DataBlock routing; the seventh covers conversation-list conversion and media serialization. The reasoning-only control passes. Typical assertion: expected: <2> but was: <1>.
Command:
mvn -B -T1C -pl :agentscope-extensions-agui -am -Dtest=AguiReasoningMediaTest -Dsurefire.failIfNoSpecifiedTests=false test
Root-cause evidence
toSingleAguiMessage collects the URL media into inputContents, but its reasoning-only early-return condition checks only the text builder, tool calls and tool-result ID. It returns before constructing the media message. splitReasoningMessage then sees an already-reasoning message and returns it alone. The public method's Javadoc says a message mixing ThinkingBlock with other content is split into reasoning and remaining content.
Environment
- AgentScope Java: 2.1.0-SNAPSHOT, main
dc077e7abfc4b2dd1062f2279dad48382256b819 - Module: agentscope-extensions-agui
- Java: 17.0.15; Maven: 3.9.12
- OS: Windows; UTF-8 process encoding
Implementation ownership
I am implementing the focused fix and regression tests and will submit the linked PR in this session. Could you assign this issue to @pengmoubuaixuexi? The intended change is to exclude collected supported media from the reasoning-only fast path, preserving the existing reasoning splitting and URL-only media scope.
AI assistance was used for source investigation and test preparation. The failure results above were executed locally; this is not a claim of a production incident or a live model/frontend test.
Activity
[-][Bug]: AG-UI conversion drops URL media from reasoning-only assistant replies[/-][+][Bug]: AG-UI conversion drops URL media from assistant messages with reasoning[/+]fix(agui): preserve URL media alongside reasoning (agentscope-ai#4009)