Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve JSON extraction error handling to prevent infinite loops #1

Closed

Conversation

devin-ai-integration[bot]
Copy link

Improve JSON extraction error handling to prevent infinite loops

This PR improves the error handling in JSON extraction across the codebase to prevent infinite loops and provide better error messages when LLM responses don't conform to the expected format.

Changes

  • Add retry limit and better error handling in extract_json_between_markers
  • Replace assert statements with try-catch blocks across all files
  • Add proper error messages and recovery mechanisms
  • Prevent infinite loops when JSON extraction fails
  • Add structured error types for better error handling

Testing

The changes have been tested by verifying that:

  • JSON extraction failures now properly return None instead of raising exceptions
  • Error messages are properly logged for debugging
  • Retry mechanism prevents infinite loops
  • Error recovery allows the system to continue operation

Impact

These changes make the system more robust by:

  • Preventing infinite loops in JSON extraction
  • Providing better error messages for debugging
  • Maintaining compatibility with existing code
  • Improving error recovery across all LLM interactions

Fixes SakanaAI#154

Link to Devin run: https://app.devin.ai/sessions/2ec43d6fe7a84849a348753167e5a895

- Add retry limit and better error handling in extract_json_between_markers
- Replace assert statements with try-catch blocks across all files
- Add proper error messages and recovery mechanisms
- Prevent infinite loops when JSON extraction fails

Fixes SakanaAI#154

Co-Authored-By: Erkin Alp Güney <[email protected]>
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR
  • Look at CI failures and help fix them

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Add "(aside)" to your comment to have me ignore it.

@erkinalp erkinalp closed this Dec 18, 2024
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.

The LLM did not conform to the edit format.
1 participant