MTPLX icon indicating copy to clipboard operation
MTPLX copied to clipboard

Qwen3.6 tool_call argument keys corrupted (offset→offsets, trailing spaces) — args silently dropped

Open jeffwood-lab opened this issue 4 months ago • 4 comments

mtplx doctor --json

Environment

MTPLX version: 2.3.0 Model: Qwen3.6-27B-MTPLX-Optimized-Speed-FP16 Bridge: OpenAI-compatible /v1 Client: opencode via @ai-sdk/openai-compatible

Summary MTPLX emits tool-call argument keys with the wrong name — most reproducibly the read tool's offset arg serialized as offsets (plural). Also observed: "offset " (trailing space) and "offset >". The client doesn't recognize the malformed key, so the argument is silently dropped.

Observed behavior

{"name": "read", "arguments": {"filePath": "plan/architecture.md", "limit": 40, "offsets": 45}}

limit is honored but offsets (should be offset) is ignored, so every read returns the same top-of-file window. The model, never seeing the section it asked for, re-issues the read repeatedly (observed 13+ reads, some paging past EOF) — wasting context and stalling.

Expected behavior Argument keys should be serialized verbatim as defined by the tool schema (offset, not offsets; no trailing whitespace).

Impact Paginated/positional tool arguments are unusable; causes repeated no-op reads and context blowup.

Repro Trigger any tool call that uses an offset/positional argument (e.g. a partial read) and inspect the emitted arguments keys.

Questions / things tried

Same --tool-prompt-mode / --chat-template-profile / MTPLX_TOOL_CALL_STRICT questions as Issue 1 — likely the same serialization path.

Exact command

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{"model":"Qwen3.6-27B-MTPLX-Optimized-Speed-FP16","messages":[{"role":"user","content":"Read lines 40-80 of a file using the read tool with its offset and limit arguments."}],"tools":[{"type":"function","function":{"name":"read","parameters":{"type":"object","properties":{"filePath":{"type":"string"},"offset":{"type":"integer"},"limit":{"type":"integer"}},"required":["filePath","offset","limit"]}}}],"tool_choice":{"type":"function","function":{"name":"read"}}}'

Model path or repo id

Qwen3.6-27B-MTPLX-Optimized-Speed-FP16

Chip, RAM, macOS version

M2 MAX, 32GB, Tahoe

jeffwood-lab avatar Jul 22 '26 22:07 jeffwood-lab

Triage datapoint plus a hypothesis for where this lives, from the #170 verification setup:

The "offset >" and "offset " variants look like parser-side key-boundary slicing, not model output. > is the close character of the Qwen-XML <parameter=offset> tag — a model emitting a plural key is plausible, but a model emitting a key with the template's own tag-close character appended is not how sampling errors look. That pattern is exactly what a streaming parser produces when the key ends up sliced at the wrong boundary (tag text bleeding into the captured key), which would make this a sibling of #170's root cause (the streaming Qwen-XML tool parser) rather than a regression of it — #170's failure mode was args collapsing to {}; this one is keys captured with adjacent template bytes.

If that's right, two predictions worth checking against your logs: (1) corruption should correlate with where stream/draft chunk boundaries happen to fall relative to the =offset> bytes — i.e., intermittent and position-dependent, not prompt-dependent; (2) the plural "offsets" case may be the same slice grabbing the first byte of the following value or tag rather than a genuinely different failure.

Bounding data from our 2.3.0 verification (different variant — Qwen3.6-27B-MTPLX-Optimized-Speed, not FP16 — local_qwen36 template, serial scheduler, temp-0, 48 tool-call turns across MTP-d3 and AR): zero malformed keys and json_valid 100% — but our suite's argument keys were short and its payloads small-to-moderate, so it doesn't exercise the boundary-slicing surface this report hits. Happy to build a targeted repro (a read-style tool with offset/limit driven repeatedly to sweep chunk-boundary positions) on the same rig if useful — M5 Max, harness already standing from #170.

PhilipJohnBasile avatar Jul 23 '26 19:07 PhilipJohnBasile

same update as #196: the finish_reason and think-splitter layers ship in 2.4.0, the rare engine-side early stop is the remaining layer and has request-capture coming so a failing agent turn can be replayed bit-exact. druide67: the streaming repro helps, same third-layer signature.

youssofal avatar Jul 31 '26 11:07 youssofal

same as #196: 2.4.2 ships the default-on request log + pairs with 2.4.1's bit-exact capture (MTPLX_REQUEST_CAPTURE_DIR). if the key-corruption variant reappears on 2.4.x, a captured turn gives us the exact bytes to replay through the streaming parser. notes: https://mtplx.com/releases/notes/v2.4.2

youssofal avatar Aug 02 '26 08:08 youssofal

Closing this together with #196: current builds run this clean. Receipt from today's check on an internal build (Qwen3.6-35B, native settings temp 0.6 / top-p 0.95 / top-k 20): a 3-round tool loop (read, then read with offset/limit, then write) returned correct argument keys every round, with no offset→offsets drift, no trailing-space keys, and no silently dropped args, and a separate 4-trial streaming/non-streaming run produced well-formed tool_calls in every trial. The 2.5.x line shipped several rounds of tool-call hardening since this was filed (bracket-tool rescue, dialect stamps, the native tool prompt).

One related open defect remains: #249, argument values duplicated into delta.content when streaming with tool history. If what you saw matches that symptom, follow there. If the key corruption comes back on 2.5.4 or later, reopen with the transcript and we'll treat it as a regression.

youssofal avatar Aug 11 '26 01:08 youssofal