fix: Repair truncated JSON tool inputs in LLM session#24289
fix: Repair truncated JSON tool inputs in LLM session#24289menardorama wants to merge 2 commits intoanomalyco:devfrom
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: Found a potentially related PR: PR #23067: fix(opencode): repair malformed JSON in tool call arguments This PR appears to address a similar issue of repairing malformed JSON in tool call arguments, which is closely related to the current PR's focus on repairing truncated JSON tool inputs. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
feel free to request more details if needed; we are totally stuck with our local models due to this bug. |
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
@rekram1-node Hi do you have time to review this PR ? It's been 2 days that users on my side are running opencode with this patch with so far no issue. This solve tool calling errors for kimi k2.6 and qwen 3.5 running on vllm (plain huggingface version). Thanks a lot |
Replace ~90 lines of custom JSON repair logic with jsonrepair library. This handles unterminated strings, missing braces/brackets, trailing commas, and other common truncation issues from LLMs like Kimi k2.6 and Qwen 3.5 running on vLLM. Refs: anomalyco#24177, anomalyco#20650, anomalyco#20786
Issue for this PR
Fixes #24177 #20650 #20786
Type of change
What does this PR do?
Use
jsonrepairlibrary to fix truncated/malformed JSON in tool call arguments from LLMs like Kimi k2.6 and Qwen 3.5 running on vLLM.Changes
jsonrepairlibraryHow did you verify your code works?
jsonrepairlibrary with actual truncated JSON examplesScreenshots / recordings
Before:
After:
Checklist