Skip to content

Conversation

ulivz
Copy link
Member

@ulivz ulivz commented Sep 13, 2025

Summary

Fixed PromptEngine failing to parse incomplete tool call JSON when LLM responses are truncated mid-stream, causing "SyntaxError: Expected ',' or ']' after array element" errors.

The issue occurred when tool calls were cut off during streaming, leaving malformed JSON that couldn't be parsed. Added robust JSON repair logic in repairIncompleteJson() method to handle:

  • Incomplete string values
  • Missing closing brackets/braces
  • Truncated arrays and objects
  • Fallback to extract tool name when repair fails

Checklist

  • Added or updated necessary tests (Optional).
  • Updated documentation to align with changes (Optional).
  • Verified no breaking changes, or prepared solutions for any occurring breaking changes (Optional).
  • My change does not involve the above items.

Copy link

netlify bot commented Sep 13, 2025

Deploy Preview for agent-tars-docs ready!

Name Link
🔨 Latest commit 8e7c3a4
🔍 Latest deploy log https://app.netlify.com/projects/agent-tars-docs/deploys/68c51f3c20af81000876e392
😎 Deploy Preview https://deploy-preview-1492--agent-tars-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant