fix(TOOLS-PARSER-BREADTH): lfm2 drops tool calls containing a nested quote or a bracket in a string
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 423
- Forks
- 53
- Avg merge
- 20h 26m
- Merged PRs (30d)
- 310
Description
Row: TOOLS-PARSER-BREADTH
Found by #2647 (PORT-NOW wave
PORTQ-3, tranche 81-120). Nothing was executed: this is a static reading of the
tree at e24ec8bfd against upstream 7303c66f68 (vllm#48171).
The earlier reading of this entry understated it
.agents/sync/2026-09-01-cdefd9d.md §13 (the #2524 worked list, read at
63889449c) ranked this third and scoped it to "one of five arms": the
nested-unescaped-quote recovery plus the streaming
contains_broken_string_literal withholding, with "the other four satisfied by
our hand-written parser rather than ast.parse".
The named symptom still reproduces exactly. [shell(command='sed -n '1,9p' f.py')] makes ParseString stop at the second '; ParseCall then sees 1
where it needs , or ) and throws; parse_call_list returns nullopt; and
src/vllm/entrypoints/openai/tool_parsers/lfm2.cpp:104-106 returns the whole
output as content with tools_called=false. The drop site is unchanged.
But only three of the four "satisfied" arms are satisfied, and four further
arms the note did not mention are missing. All four live in
get_parameter_value, which upstream shares across every pythonic parser:
ast.UnaryOp— a negative number is rejected.
src/vllm/entrypoints/openai/tool_parsers/pythonic_core.cpp:157-159throws on
a leading-, and its comment says "matchingget_parameter_value", which was
true before this commit and is false after it.
include/vllm/entrypoints/openai/tool_parsers/pythonic_core.h:19-20records
the rejection as an intentional deviation; vllm#48171 invalidates the reason.ast.Tupleandast.Set→ list.ParseValue(:149-160) has no(
arm, andParseDict(:260-297) requires a:after a key.- placeholder-free
JoinedStr—f'hello'reachesParseNameLiteral
(:299-308) and is rejected.
And the streaming guard: make_valid_python (:361-377) tracks quotes but never
skips brackets inside a string, so a streamed cmd='grep -F "]"' still
corrupts the bracket stack — that is the "brackets" of the PR title — and its
escape test at :366 is the single-character check upstream replaced with an
odd-backslash-run test.
Genuinely already satisfied, and worth recording so nobody re-ports them: raw
control characters inside strings (ParseString appends them verbatim, so
escape_ctrl_chars_in_strings is unnecessary), leading-zero integers
(ParseNumber → stoll("07") = 7), reserved-keyword kwargs (ParseIdentifier
:94-99 accepts from, in, class), the empty-list rejection (:46-50), the
streaming lstrip, and the non-JSON-constant rejection.
Size
~250-350 lines across pythonic_core.{h,cpp}, lfm2.cpp and tests. The
get_parameter_value arms belong in the shared core, because upstream put them
in shared utils.py and every pythonic-family parser reads them; the
requote-and-withhold recovery is lfm2-local.
Why it matters
This is a live, user-visible drop on a shipped --tool-call-parser: a tool call
containing a nested quote or a bracket in a string is silently returned as prose
with tools_called=false. It is not a mirror repair whose symptom is
unreachable.
Owner
TOOLS-PARSER-BREADTH (.agents/engine-matrix.md:166, spec
.agents/specs/tool-parser-breadth.md). Entirely distinct from
#2637 and
#2638, which are the parser
engine; this is the legacy --tool-call-parser family.
Not in scope here
This issue does not advance the parity pin. 7303c66f68 is inside the
5559679229..e126687a9a window that #2611
owns.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with include/vllm/entrypoints/openai/tool_parsers/pythonic_core.h, pythonic_core.cpp, and lfm2.cpp, especially get_parameter_value, make_valid_python, and the reported drop site. Compare the listed parser behavior with upstream vllm#48171, then inspect the existing parser tests. Done means nested quotes and brackets no longer drop tool calls, the listed value forms parse correctly, and streaming withholding handles brackets inside strings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- ai-infra-agents
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100