Repository navigation
fix(agui): preserve document tool error round trips - #4036
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
ningmao-hlyz
left a comment
There was a problem hiding this comment.
The fix is correct and the tests are effective: AguiToolDocumentErrorTest fails 6 of 10 cases on 85fa9a60 and passes 10/10 on d2a84a82. CI is green on both runners and the EN/ZH notes match the implementation.
No blocking concerns. Four small points below.
|
LGTM |
@pengmoubuaixuexi The four threads can be resolved now |
|
Updated this branch to main at decbe55. The resolution keeps the tool sender name that main now emits, along with this PR's handling of failed tool results. The six document cases now check the name alongside the restored success/error state for URL, inline Base64 and file-ID sources. All six failed with a missing name when I tested a resolution that kept the old constructor. At a14e7ae, all 512 AG-UI module tests passed with no skips ( |
AgentScope-Java Version
2.1.0-SNAPSHOT, based on main
85fa9a60257ceb1570e6a195d0588ceba1e8a8c2.Description
Fixes #4035.
An
ERRORtool result containing only a document currently serializes to structured AG-UI content with an emptyerror. After JSON deserialization,toMsgrestores it asSUCCESS. Results containing both a document and a textual error have a related problem: the structured-input branch prepends the diagnostic again, duplicating it during repeated history conversion.When failed tool output has blank text, render a document reference before assembling the content; if neither text nor a document reference can be rendered, use
Tool execution failed. The fallback is included in both content and error, so a document-only failure keeps a stable block order from its first JSON round trip. On structured input, prepend a distinct error only when no text block already contains it. Document sources, IDs and successful output (including whitespace) retain their behavior; manually built empty/blank failures now retain ERROR too. This follows the structured-document support in #3979 and applies the existing plain-text non-duplication intent from #3932 to this new path.Sixteen regression cases exercise the public converter and actual JSON round trips: URL/Base64/provider-file document failures and success controls with three-trip output-shape comparisons; empty output, empty text and whitespace-only results with ERROR/SUCCESS controls; a whitespace-only document diagnostic; multiple results with different states; repeated round trips with one diagnostic; and a distinct frontend error. The Base64 case explicitly asserts
inline base64is present in the error and the payload is absent. EN/ZH notes describe the final fallback and stable-shape semantics.Validation
Windows, Temurin Java 17.0.15, Maven 3.9.12;
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8. Commands ran from the repository root with-B -T1C.mvn -B -T1C -pl :agentscope-extensions-agui -am -Dtest=AguiToolDocumentErrorTest,AguiMessageConverterTest,AguiReasoningMediaTest -Dsurefire.failIfNoSpecifiedTests=false test(initial implementation): 106 passed, zero failures/errors/skips.mvn -B -T1C -pl :agentscope-extensions-agui -am -DskipTests clean install: passed; this dependency build skips tests.mvn -B -T1C -pl :agentscope-extensions-agui clean verify: 593 passed, zero failures/errors/skips; Spotless, Javadoc and packaging passed.docs/:npm ci --ignore-scripts,npm test(13 passed),npm run validate: passed.npm run broken-links: 2,224 links in 328 files on both this change and pristine main; all 2,552 ordered file/target rows are identical (existing site issues, no newly introduced targets).git diff --check: passed; complete staged diff inspected. Main was fetched again before initial submission and remained at the stated base.a02699c5: the expanded 16-case regression on prior PR productiond2a84a82has 6 failures, 0 errors/skips (three empty/blank ERROR cases and three document-order comparisons); the final implementation passes 16/16, included in the 593-test module check. Both platform checks passed ond2a84a82; the new commit must complete CI again.This is an offline converter/serialization regression. It does not download documents, call a model, test a frontend or claim stable-release coverage. Full-repository tests were not run and no coverage percentage is claimed.
After #4297 added outbound media sources, I checked the same failure mode with an image-only tool result on
2fb5400e. The probe callstoAguiMessages, serializes and parses the resultingAguiMessagewith the JSON codec, then callstoMsg. On main, both inline Base64 and provider file-ID images retained their source and tool-call ID, but anERRORresult came back asSUCCESS. Both success controls passed. With this PR's existing patch (a02699c5) applied to that main revision, all four cases passed. The three related converter suites also passed (118 cases). The four additional cases were a local compatibility check on Windows with Java 17.AI assistance was used for investigation, implementation, tests and diff review. The stated checks were executed locally.
Checklist