Skip to content

fix: Add error detection function and test for ZeroDivisionError and other errors alike#1332

Merged
sitabulaixizawaluduo merged 4 commits into
areal-project:mainfrom
chenzhiyi021:tir-exp
May 13, 2026
Merged

fix: Add error detection function and test for ZeroDivisionError and other errors alike#1332
sitabulaixizawaluduo merged 4 commits into
areal-project:mainfrom
chenzhiyi021:tir-exp

Conversation

@chenzhiyi021
Copy link
Copy Markdown
Contributor

@chenzhiyi021 chenzhiyi021 commented May 11, 2026

Description

Fix Python tool error handling to properly report execution failures

Currently, PythonTool.execute() always returns ToolCallStatus.SUCCESS even when code execution fails (e.g., ZeroDivisionError, syntax errors). This led to the problem of the AsyncTaskRunner crash issue during training when agent code has ZeroDivisionError.

This PR fixes the issue by:

  • Returning ToolCallStatus.ERROR when report != "Done"

  • Adding comprehensive unit tests for error scenarios

Related Issue

Fixes #1333

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation update
  • ♻️ Refactoring
  • ⚡ Performance improvement
  • ✅ Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • Pre-commit hooks pass (pre-commit run --all-files)
  • Relevant tests pass; new tests added for new functionality
  • Documentation updated (if applicable; built with ./docs/build_all.sh)
  • Branch is up to date with main
  • Self-reviewed via /review-pr command
  • This PR was created by a coding agent via /create-pr
  • This PR is a breaking change

Breaking Change Details (if applicable):

Additional Context


Need help? Check the Contributing Guide or ask in
GitHub Discussions!

@sitabulaixizawaluduo
Copy link
Copy Markdown
Collaborator

Please run "pre-commit run --all-files" to correct the file format.

@chenzhiyi021
Copy link
Copy Markdown
Contributor Author

I updated the code checked by pre-commit.

@sitabulaixizawaluduo
Copy link
Copy Markdown
Collaborator

I updated the code checked by pre-commit.

Hi @chenzhiyi021, this PR has conflicts with `main`. Could you rebase to resolve them? Thanks!

@chenzhiyi021
Copy link
Copy Markdown
Contributor Author

chenzhiyi021 commented May 13, 2026

Thanks for your info. I solved the conflict.

@sitabulaixizawaluduo sitabulaixizawaluduo merged commit 8eaf9e4 into areal-project:main May 13, 2026
1 check passed
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.

[BUG] Python tool error handling leads to AsyncTaskRunner crash issue during training when agent code has ZeroDivisionError

2 participants