Repository navigation
fix(models): preserve escaped newlines in MindIE XML JSON arguments - #6334
WillemJiang merged 3 commits into
Conversation
willem-bd
left a comment
There was a problem hiding this comment.
Reviewed against bb97fa1. The core fix is sound: parsing XML tool calls from the original payload before the display-oriented newline decode preserves JSON argument fidelity, the added strip after decode correctly retains the old trailing-whitespace trimming (the parser's strip cannot remove trailing literal \n that decode then turns into real newlines), the unparseable-XML else branch keeps the existing prose/fence behavior, and the now-unconditional parse early-returns cheaply when no <tool_call> marker is present. I ran backend/tests/test_mindie_provider.py at this head in an isolated worktree: 57 passed, and ruff check/format are clean. One important design concern below about non-JSON multi-line parameters, plus a README placement nit.
|
Hi @willem-bd, both review points are addressed in 2670be1, with implementation details and regression results in the two inline replies. The contributor has confirmed the required human review/responsibility statement, and this PR is ready for review and no longer has merge conflicts. Local verification: 97 MindIE tests passed; the combined MindIE/model-factory/lead-agent suite gives 317 passed. Blocking-I/O gives 213 passed, 15 skipped. Backend lint/format and agent-guidance checks passed. The broader Windows suite still encounters the pre-existing POSIX file-mode assertion, so I am not claiming a full-suite pass. Update: the contributor has signed the CLA, and The new upstream Actions runs still report |
Why
MindIE's escaped-newline compatibility conversion currently runs over the entire response before XML tool-call extraction. JSON arguments such as
{"text":"line1\nline2"}can then contain an unescaped control character and fall back to a string; literal backslashes can also change silently.Parse structured arguments from the original response while retaining the gateway's existing multiline behavior for ordinary raw-string parameters. The reproduction is offline with mocked model responses; no live MindIE endpoint or production incident is claimed.
What changed
\ndecoding for non-JSON raw-string fallback values, outside fenced code, including surrounding-whitespace trimming. Multi-line file contents and commands keep working. Raw strings cannot distinguish intended literal escapes from gateway-escaped newlines; that existing ambiguity is documented explicitly.main. Rejected numeric containers retain the entire original argument.backend/docs/CONFIGURATION.md#mindie-xml-tool-arguments; the README configuration list now contains a short link. Update the model guidance to the same contract.Current
mainat35cdcab1c5492e27e5d4dc525861256344cc5133has been merged into the branch, retaining its numeric parsing and structured tool-result changes and resolving the model-guidance conflict.Surface area
Bug fix verification
main(a558884c3ad1625caf5db2c78e8902b6c6feb0d9): 8 failed, 49 passed. This is the original submission's recorded reproduction.tests/test_mindie_provider.py.Validation
Actual follow-up execution on Windows / Python 3.12:
git diff --check: passed.Broader Windows offline runs stop on the existing POSIX file-mode expectation in
test_channel_file_attachments.py::TestInboundFileSandboxPerms::test_make_inbound_file_sandbox_readable_sets_group_other_read(0o666versus0o644): before synchronization 1 failed, 2748 passed, 108 skipped, 7 deselected; after this follow-up 1 failed, 2788 passed, 108 skipped, 7 deselected. No full Windows-suite pass is claimed. Linux CI results are recorded separately when available. No live model/API integration tests were run.AI assistance
Tool(s) used: Codex desktop; Luna Max for a bounded, local read-only patch review.
How you used it: Codex reproduced the defects, implemented the patch and reviewer follow-up, synchronized the fork branch with current main, updated documentation and ran the checks above at the contributor's request. Luna Max reviewed the scoped patch without modifying files. The change is AI-authored. The contributor has confirmed reading and understanding every line and taking responsibility for the change. Maintainer approval and CLA acceptance are separate from automated checks.