Skip to content

fix(chat): hold closing tags after empty XML parameters - #249

Merged
Vasyl-Trefilov merged 1 commit into
RustingStudio:mainfrom
NginxL:e25/247-empty-parameter-boundary
Dec 6, 2026
Merged

Vasyl-Trefilov merged 1 commit into
RustingStudio:mainfrom
NginxL:e25/247-empty-parameter-boundary

Conversation

@NginxL

@NginxL NginxL commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #247.

Fixes the streaming XML tool-call boundary for an empty string parameter. After the leading newline is removed, the remaining partial closing tag no longer includes the newline used by the previous hold-back pattern. The parser could therefore emit the closing tag text as the parameter value ("</parameter") before the complete closing tag arrived.

The hold-back now checks both forms of a possible closing-tag suffix: with the newline and without it. Non-empty values retain the existing newline-holding behavior.

Added a regression test for an edit call with an empty new_string and a following old_string. It verifies the parsed arguments and scans every byte prefix to ensure streamed argument JSON remains a prefix of the completed call.

Checks

  • cargo test --lib partial_empty_string_parameter_does_not_leak_closing_tag: focused regression test.
  • cargo test --lib partial_calls_are_prefixes: existing streaming-prefix coverage.
  • git diff --check: passed.
  • cargo fmt --all -- --check reports broad pre-existing formatting drift across untouched files; no repository-wide reformat was applied.
  • No model inference, CUDA/Vulkan runtime, or real Qwen Code session was exercised.

AI disclosure

Prepared with AI assistance (Little Code Sauce) and reviewed against xml_partial, xml_value, and the existing partial_calls_are_prefixes test. All commits include a DCO sign-off.

Co-Authored-By: Little Code Sauce <little-code-sauce@example.com>
Signed-off-by: NginxL <8777777+NginxL@users.noreply.github.com>
@aletheore

aletheore Bot commented Dec 6, 2026

Copy link
Copy Markdown

Aletheore Flash review

Flash review skipped: draft pull request. It will run when the pull request is marked ready for review.

@aletheore

aletheore Bot commented Dec 6, 2026

Copy link
Copy Markdown

🔍 Aletheore evidence diff

graph LR
    n0["src/chat.rs"]
    n1["src/deepseek/chat.rs"]
    n2["src/gemma4/mod.rs"]
    n3["src/gigachat4/chat.rs"]
    n4["src/glm/mod.rs"]
    n5["src/hy4/chat.rs"]
    n6["src/inkling2/chat.rs"]
    n7["src/kolibri/chat.rs"]
    n8["lib.rs"]
    n9["main.rs"]
    n10["src/raon/chat.rs"]
    n11["src/serve.rs"]
    n12["tests/serve.rs"]
    n13["vision.rs"]
    n0 --> n1
    n0 --> n2
    n0 --> n3
    n0 --> n4
    n0 --> n5
    n0 --> n6
    n0 --> n7
    n0 --> n8
    n0 --> n9
    n0 --> n10
    n0 --> n11
    n0 --> n12
    n0 --> n13
    classDef changed fill:#d9772c,color:#fff,stroke:#b85f1c;
    classDef changedFinding fill:#c0392b,color:#fff,stroke:#922b21;
    classDef dependent fill:#f2f0ec,color:#18140f,stroke:#d6d0c5;
    class n0 changed
    class n1 dependent
    class n2 dependent
    class n3 dependent
    class n4 dependent
    class n5 dependent
    class n6 dependent
    class n7 dependent
    class n8 dependent
    class n9 dependent
    class n10 dependent
    class n11 dependent
    class n12 dependent
    class n13 dependent
Loading

What changed
Deterministic, computed from this commit's real scan and import graph - posted on every run, whether or not Flash Review found anything.

  • src/chat.rs · modified · +37/-3 · +1 function · 13 other dependents

Aggregate deltas

  • Modules: +0
  • Dependency graph edges: +0
  • Commits: 1

@Vasyl-Trefilov

Copy link
Copy Markdown
Member

Hi, ty, clean fix and a good test. I checked it: holding back both forms of the closing tag keeps every streamed piece a prefix of the final call, and non-empty values work like before. The chat tests pass. It is merged now and goes into the next release.

@Vasyl-Trefilov
Vasyl-Trefilov merged commit 2abe6cc into RustingStudio:main Dec 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Qwen4-35B-A3B XML tool-call parser captures "</parameter" when edit tool passes empty string

2 participants